Example #1
0
    def do_POST(self):
        self._handle_class = Transcoder()
        content_length = int(self.headers.get_all('Content-Length')[0])
        content_type = self.headers.get_all('Content-Type')[0]
        self._boundary = content_type.split('boundary=', maxsplit=1)[1]
        self.buf = b''
        self._status_content = "HEAD"  # HEAD, BODY
        self._content_key = ""

        new_line = ''
        buf = ''

        while content_length > 0:
            want_byte = 4096
            if content_length > want_byte:
                buf = self.rfile.read(want_byte)
            else:
                buf = self.rfile.read(content_length)
            content_length -= want_byte
            self.buf = self.buf + buf

            while True:
                line_end = self.buf.find(b'\r\n')
                if line_end == -1:
                    break
                else:
                    self._handle_a_line(self.buf[:line_end + 2])
                    self.buf = self.buf[line_end + 2:]

        self.send_response(200)
        self.send_header("Content-type", "text/html")
        self.end_headers()
Example #2
0
def simulator_evaluate(expression):
    alto_source = Transcoder.to_alto("doIt [^[" + expression + "]]")
    object_cls = Runtime.Smalltalk._ref(UniqueString._for("Object"))
    method_tuple = Compiler().compileIn(ByteString(alto_source), object_cls)
    method = method_tuple._ref(Integer(2))
    result = Simulator(Context(None, None, object_cls, method)).run()
    print(expression, "=>", result)
def test_transcoder01():
    with open('evaluation.json') as json_file:
        json_data = json.load(json_file)
    for each in json_data:
        source = each['source']
        alto_source = each['alto_source']
        transcoded_source = Transcoder.to_alto("doIt [^[" + source + "]]")
        assert transcoded_source == alto_source
 def __init__(self):
     super(TranscoderJob, self).__init__(self)
     
     # Audio converter thread.
     self.__thread = threading.Thread(target=self.__run)
     self.__thread.setDaemon(True)
     self.__condition = threading.Condition()
     self.transcoder = Transcoder()
Example #5
0
    def init_transcoder(self, attr):
        self.raw_song = attr["song"]
        self.output_path = attr["output"]
        if os.path.exists(self.output_path) and attr["prompt"]:
            self.exists_prompt = True
        else:
            self.exists_prompt = False

        if self.raw_song.get_path() == self.output_path:
            self.skip_flag = True

        self.output_ext = FORMATS[attr["format"]]["extension"]
        self.transcoder = Transcoder()
        self.transcoder.set_format(attr["format"])
        self.transcoder.set_quality(attr["quality"])
        if self.raw_song.get_type() == "audiocd":
            self.transcoder.set_cd_input(self.raw_song.get("uri"))
        else:
            self.transcoder.set_input(attr["song"].get_path())
        self.transcoder.set_output(self.output_path)
        self.transcoder.end_cb = self.__end
 def init_transcoder(self, attr):
     self.raw_song = attr["song"]
     self.output_path = attr["output"]
     if os.path.exists(self.output_path) and attr["prompt"]:
         self.exists_prompt = True
     else:    
         self.exists_prompt = False
     self.output_ext = FORMATS[attr["format"]]["extension"]
     self.transcoder = Transcoder()        
     self.transcoder.set_format(attr["format"])
     self.transcoder.set_quality(attr["quality"])
     if self.raw_song.get_type() == "audiocd":
         self.transcoder.set_cd_input(self.raw_song.get("uri"))
     else:    
         self.transcoder.set_input(attr["song"].get_path())
     self.transcoder.set_output(self.output_path)
     self.transcoder.end_cb = self.__end
Example #7
0
def simulator_jevaluate(source, evaluation_list):
    evaluation_dictionary = {}
    evaluation_list.append(evaluation_dictionary)
    evaluation_dictionary['source'] = source
    alto_source = Transcoder.to_alto("doIt [^[" + source + "]]")
    evaluation_dictionary['alto_source'] = alto_source
    evaluation_dictionary['lexem'] = ([
        each if isinstance(each, int) else each.toString()
        for each in ByteString(alto_source).asVector().elements()
    ])
    object_cls = Runtime.Smalltalk._ref(UniqueString._for("Object"))
    method_tuple = Compiler().compileIn(ByteString(alto_source), object_cls)
    evaluation_dictionary['selector'] = method_tuple._ref(
        Integer(1)).toString()
    evaluation_dictionary['codes '] = str(
        EscapeAll(bytes(method_tuple._ref(Integer(2)).codes().fBytes)))
    method = method_tuple._ref(Integer(2))
    return Simulator(JContext().set(None, Obj.NIL, object_cls, method)).run()
class TranscoderJob(gobject.GObject):
    
    __gsignals__ = {
        "end"            : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
        "redraw-request" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
        }
    
    __stop     = False
    __pause    = False
    __is_alive = True
    priority   = 10
    
    def __init__(self, trans_data):
        gobject.GObject.__init__(self)
        self.__updater_id = None
        
        # Init data.
        self.angle = 0
        self.status_icon = app_theme.get_pixbuf("transcoder/wait.png").get_pixbuf()
        self.status_icon_press = app_theme.get_pixbuf("transcoder/wait_press.png").get_pixbuf()
        self.stop_icon = app_theme.get_pixbuf("transcoder/stop.png").get_pixbuf()
        self.progress_ratio = 0.0
        self.skip_flag = False        
        self.trans_data = trans_data
        self.init_transcoder(trans_data)   
        self.__update()        
        self.progress_buffer = ProgressBuffer()

    def start(self):    
        if self.skip_flag:
            self.finish_job()
        else:    
            self.transcoder.start_transcode()
            self.__set_status_icon("working")
            self.__updater_id = gobject.timeout_add(500, self.update_progress)
        
    def update_progress(self):    
        self.set_progress_ratio(self.transcoder.get_ratio())
        return True
    
    def __update(self):    
        self.title = self.trans_data["song"].get_str("title")
        
        self.status_icon_padding_x = 10
        self.status_icon_padding_y = 5
        self.status_icon_w, self.status_icon_h = (self.status_icon.get_width(), self.status_icon.get_height())
        
        self.title_padding_x = 5
        self.title_padding_y = 5
        self.title_w, self.title_h = get_content_size(self.title, DEFAULT_FONT_SIZE)
        
        self.progress_padding_x = 10
        self.progress_padding_y = 5
        self.progress_w, self.progress_h = 100, 10
        
        self.stop_icon_padding_x = 5
        self.stop_icon_padding_y = 5
        self.stop_icon_w, self.stop_icon_h = (self.stop_icon.get_width(), self.stop_icon.get_height())
        
        self.ext_padding_x = 5
        self.ext_padding_y = 5
        self.ext_w, self.ext_h = get_content_size(self.output_ext, DEFAULT_FONT_SIZE)
        
    def init_transcoder(self, attr):
        self.raw_song = attr["song"]
        self.output_path = attr["output"]
        if os.path.exists(self.output_path) and attr["prompt"]:
            self.exists_prompt = True
        else:    
            self.exists_prompt = False
            
        if self.raw_song.get_path() == self.output_path:
            self.skip_flag = True
                        
        self.output_ext = FORMATS[attr["format"]]["extension"]
        self.transcoder = Transcoder()        
        self.transcoder.set_format(attr["format"])
        self.transcoder.set_quality(attr["quality"])
        if self.raw_song.get_type() == "audiocd":
            self.transcoder.set_cd_input(self.raw_song.get("uri"))
        else:    
            self.transcoder.set_input(attr["song"].get_path())
        self.transcoder.set_output(self.output_path)
        self.transcoder.end_cb = self.__end
        
    def __end(self):    
        try:
            self.write_tags()
        except:    
            pass
        
        self.finish_job()
                
    def finish_job(self):            
        self.emit("end")
        self.__set_status_icon("success")
        self.set_progress_ratio(1.0)
        try:
            gobject.source_remove(self.__updater_id)
        except: pass
        
        if self.trans_data["to_playlist"]:
            tags = {"uri" : utils.get_uri_from_path(self.output_path)}
            song = MediaDB.get_or_create_song(tags, "local", read_from_file=True)
            if song:
                Dispatcher.add_songs([song])
                
    def write_tags(self):    
        tags = deepcopy(self.raw_song)
        tags["uri"] = utils.get_uri_from_path(self.output_path)
        s = Song()
        s.init_from_dict(tags)
        s.write_to_file()
        
    @property    
    def is_running(self):    
        return self.transcoder.running
        
    @property
    def is_finish(self):
        return self.transcoder.is_eos
    
    def force_stop(self):    
        try:
            gobject.source_remove(self.__updater_id)
        except: pass    
        
        if self.transcoder.running:
            self.transcoder.pause()
        try:    
            os.unlink(self.output_path)
        except: pass
        
    def playpause(self):    
        if self.transcoder.running:
            if self.transcoder.is_pause:
                self.transcoder.playing()
                self.__updater_id = gobject.timeout_add(500, self.update_progress)
                return True
            else:    
                try:
                    gobject.source_remove(self.__updater_id)
                except:    
                    pass
                self.transcoder.pause()
                return True
        return False    
        
    def set_progress_ratio(self, value):    
        self.progress_ratio = value
        self.emit_redraw_request()
        
    def set_index(self, index):
        '''Update index.'''
        self.index = index
        
    def get_index(self):
        '''Get index.'''
        return self.index
    
    def __set_status_icon(self, name):
        self.status_icon = app_theme.get_pixbuf("transcoder/%s.png" % name).get_pixbuf()
        self.status_icon_press = app_theme.get_pixbuf("transcoder/%s_press.png" % name).get_pixbuf()
        self.emit_redraw_request()
        
    def set_error_status(self):    
        self.__set_status_icon("error")
        
    def emit_redraw_request(self):
        '''Emit redraw-request signal.'''
        self.emit("redraw-request")
        
    def render_icon(self, cr, rect, in_select, in_highlight):    
        icon_x = rect.x + self.status_icon_padding_x
        icon_y = rect.y + (rect.height - self.status_icon_h) / 2
        if in_select:
            draw_pixbuf(cr, self.status_icon_press, icon_x, icon_y)
        else:    
            draw_pixbuf(cr, self.status_icon, icon_x, icon_y)
    
    def render_title(self, cr, rect, in_select, in_highlight):
        rect.x += self.title_padding_x
        rect.width -= self.title_padding_x * 2
        render_item_text2(cr, self.title, rect, in_select, in_highlight)
    
    def render_progress(self, cr, rect, in_select, in_highlight):
        self.progress_buffer.progress = self.progress_ratio * 100
        progress_x = rect.x + self.progress_padding_x
        progress_y = rect.y + (rect.height - self.progress_h) / 2
        progress_rect = gtk.gdk.Rectangle(progress_x, progress_y, self.progress_w, self.progress_h)
        self.progress_buffer.render(cr, progress_rect)        
    
    def render_stop(self, cr, rect, in_select, in_highlight):
        icon_x = rect.x + self.stop_icon_padding_x
        icon_y = rect.y + (rect.height - self.stop_icon_h) / 2
        draw_pixbuf(cr, self.stop_icon, icon_x, icon_y)
        
    def render_ext(self, cr, rect, in_select, in_highlight):    
        rect.x += self.ext_padding_x
        rect.width -= self.ext_padding_x * 2
        render_item_text2(cr, self.output_ext.upper(), rect, in_select, in_highlight)
        
    def get_ext_type(self):    
        gio_file = gio.File(self.output_path)
        gio_file_info = gio_file.query_info(",".join([gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
                                                      gio.FILE_ATTRIBUTE_STANDARD_TYPE, 
                                                      gio.FILE_ATTRIBUTE_STANDARD_NAME,
                                                      gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
                                                      gio.FILE_ATTRIBUTE_STANDARD_SIZE,
                                                      gio.FILE_ATTRIBUTE_STANDARD_ICON,
                                                      gio.FILE_ATTRIBUTE_TIME_MODIFIED,
                                                      gio.FILE_ATTRIBUTE_TIME_CHANGED,]))
        
        info_attr = gio_file_info.get_attribute_as_string(gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE)                
        return gio.content_type_get_description(info_attr)
    
    def get_column_sizes(self):
        return [
            (36, self.status_icon_h + self.status_icon_padding_y * 2),
            (135, self.title_h + self.title_padding_y * 2),
            (120, self.progress_h + self.progress_padding_y * 2),
            # (26, self.stop_icon_h + self.stop_icon_padding_y * 2),
            (50, self.ext_h + self.ext_padding_y),
            ]
    
    def get_renders(self):
        return [ self.render_icon, self.render_title, self.render_progress, self.render_ext]
Example #9
0
from mutagen.flac import FLAC
from mutagen.easyid3 import EasyID3
from mutagen.mp3 import MP3
from mutagen.id3 import TPOS

sys.path.append(sys.path[0] + '/base')
from transcoder import Transcoder
from codec import *

sys.path.append(sys.path[0] + '/codecs')
from flaccodec import FLACCodec
from mp3codec import MP3Codec

def CopyTags(source_file, target_file):
   f = FLAC(source_file)
   m = EasyID3(target_file)

   for key in ['artist', 'title', 'album', 'date', 'genre', 'tracknumber']:
      if f.has_key(key):
         m[key] = f[key]
   m.save()

   if f.has_key('discnumber'):
      m = MP3(target_file)
      m['TPOS'] = TPOS(encoding=3, text=f['discnumber'])
      m.save()

# Main
trans = Transcoder(FLACCodec, MP3Codec, CopyTags)
trans.Go()
Example #10
0
#!/usr/bin/env python

import os
import time
from transcoder import Transcoder

tr = Transcoder()
for i in range(100,3100,100):
        time1= time.time()
#       success = tr.transcode(input_file="/tmp/test-1.yuv", output_file="/tmp/"+str(i)+".264", opts=[str(i)])
        success = tr.transcode(input_file="/tmp/test-1.264", output_file="/tmp/"+str(i)+".mp4", opts=['-vcodec', 'libx264', '-vpre', 'ultrafast', '-b', str(i)+'k' ])
        print i, time.time() - time1
class TranscoderJob(gobject.GObject):
    
    __gsignals__ = {
        "end"            : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, tuple()),
        "redraw-request" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
        }
    
    __stop     = False
    __pause    = False
    __is_alive = True
    priority   = 0
    
    def __init__(self):
        super(TranscoderJob, self).__init__(self)
        
        # Audio converter thread.
        self.__thread = threading.Thread(target=self.__run)
        self.__thread.setDaemon(True)
        self.__condition = threading.Condition()
        self.transcoder = Transcoder()
        
    def __run(self):    
        for p in self.job():
            self.__condition.acquire()
            while self.__pause:
                self.__condition.wait()
            
            if self.__stop:    
                self.__condition.release()
                break
            self.__condition.release()
            
        self.__condition.acquire()    
        self.on_stop()
        self.__is_alive = False
        self.emit("end")
        self.__condition.release()
    
    def job(self):
        self.transcoder.set_format()
        self.transcoder.set_quality()
    
    def on_start(self):
        pass
    
    def start(self):
        self.on_start()
        self.__thread.start()
        
    def pause(self):    
        self.__condition.acquire()
        self.__pause = False
        self.__condition.notify()
        self.__condition.release()
        
    def unpuase(self):    
        self.__condition.acquire()
        self.__pause = True
        self.__condition.notify()
        self.__condition.release()

    def on_stop(self):    
        pass
    
    def stop(self):
        self.condition.acquire()
        self.__stop = True
        self.condition.release()
        
    # widget.    
    def set_index(self, index):
        '''Update index.'''
        self.index = index
        
    def get_index(self):
        '''Get index.'''
        return self.index
        
    def emit_redraw_request(self):
        '''Emit redraw-request signal.'''
        self.emit("redraw-request")
Example #12
0
#!/usr/bin/env python

import sys

sys.path.append(sys.path[0] + '/base')
from transcoder import Transcoder
from codec import *

sys.path.append(sys.path[0] + '/codecs')
from apecodec import APECodec
from flaccodec import FLACCodec

# Main
trans = Transcoder(APECodec, FLACCodec)
trans.Go()
Example #13
0
#!/usr/bin/env python

import sys

sys.path.append(sys.path[0] + '/base')
from transcoder import Transcoder
from codec import *

sys.path.append(sys.path[0] + '/codecs')
from mp3codec import MP3Codec

# Main
trans = Transcoder(None, MP3Codec)
trans.Go()
Example #14
0
#!/usr/bin/env python

import sys

sys.path.append(sys.path[0] + '/base')
from transcoder import Transcoder
from codec import *

sys.path.append(sys.path[0] + '/codecs')
from apecodec import APECodec
from mp3codec import MP3Codec

# Main
trans = Transcoder(APECodec, MP3Codec)
trans.Go()
Example #15
0
class TranscoderJob(gobject.GObject):

    __gsignals__ = {
        "end": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
        "redraw-request": (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
    }

    __stop = False
    __pause = False
    __is_alive = True
    priority = 10

    def __init__(self, trans_data):
        gobject.GObject.__init__(self)
        self.__updater_id = None

        # Init data.
        self.angle = 0
        self.status_icon = app_theme.get_pixbuf(
            "transcoder/wait.png").get_pixbuf()
        self.status_icon_press = app_theme.get_pixbuf(
            "transcoder/wait_press.png").get_pixbuf()
        self.stop_icon = app_theme.get_pixbuf(
            "transcoder/stop.png").get_pixbuf()
        self.progress_ratio = 0.0
        self.skip_flag = False
        self.trans_data = trans_data
        self.init_transcoder(trans_data)
        self.__update()
        self.progress_buffer = ProgressBuffer()

    def start(self):
        if self.skip_flag:
            self.finish_job()
        else:
            self.transcoder.start_transcode()
            self.__set_status_icon("working")
            self.__updater_id = gobject.timeout_add(500, self.update_progress)

    def update_progress(self):
        self.set_progress_ratio(self.transcoder.get_ratio())
        return True

    def __update(self):
        self.title = self.trans_data["song"].get_str("title")

        self.status_icon_padding_x = 10
        self.status_icon_padding_y = 5
        self.status_icon_w, self.status_icon_h = (
            self.status_icon.get_width(), self.status_icon.get_height())

        self.title_padding_x = 5
        self.title_padding_y = 5
        self.title_w, self.title_h = get_content_size(self.title,
                                                      DEFAULT_FONT_SIZE)

        self.progress_padding_x = 10
        self.progress_padding_y = 5
        self.progress_w, self.progress_h = 100, 10

        self.stop_icon_padding_x = 5
        self.stop_icon_padding_y = 5
        self.stop_icon_w, self.stop_icon_h = (self.stop_icon.get_width(),
                                              self.stop_icon.get_height())

        self.ext_padding_x = 5
        self.ext_padding_y = 5
        self.ext_w, self.ext_h = get_content_size(self.output_ext,
                                                  DEFAULT_FONT_SIZE)

    def init_transcoder(self, attr):
        self.raw_song = attr["song"]
        self.output_path = attr["output"]
        if os.path.exists(self.output_path) and attr["prompt"]:
            self.exists_prompt = True
        else:
            self.exists_prompt = False

        if self.raw_song.get_path() == self.output_path:
            self.skip_flag = True

        self.output_ext = FORMATS[attr["format"]]["extension"]
        self.transcoder = Transcoder()
        self.transcoder.set_format(attr["format"])
        self.transcoder.set_quality(attr["quality"])
        if self.raw_song.get_type() == "audiocd":
            self.transcoder.set_cd_input(self.raw_song.get("uri"))
        else:
            self.transcoder.set_input(attr["song"].get_path())
        self.transcoder.set_output(self.output_path)
        self.transcoder.end_cb = self.__end

    def __end(self):
        try:
            self.write_tags()
        except:
            pass

        self.finish_job()

    def finish_job(self):
        self.emit("end")
        self.__set_status_icon("success")
        self.set_progress_ratio(1.0)
        try:
            gobject.source_remove(self.__updater_id)
        except:
            pass

        if self.trans_data["to_playlist"]:
            tags = {"uri": utils.get_uri_from_path(self.output_path)}
            song = MediaDB.get_or_create_song(tags,
                                              "local",
                                              read_from_file=True)
            if song:
                Dispatcher.add_songs([song])

    def write_tags(self):
        tags = deepcopy(self.raw_song)
        tags["uri"] = utils.get_uri_from_path(self.output_path)
        s = Song()
        s.init_from_dict(tags)
        s.write_to_file()

    @property
    def is_running(self):
        return self.transcoder.running

    @property
    def is_finish(self):
        return self.transcoder.is_eos

    def force_stop(self):
        try:
            gobject.source_remove(self.__updater_id)
        except:
            pass

        if self.transcoder.running:
            self.transcoder.pause()
        try:
            os.unlink(self.output_path)
        except:
            pass

    def playpause(self):
        if self.transcoder.running:
            if self.transcoder.is_pause:
                self.transcoder.playing()
                self.__updater_id = gobject.timeout_add(
                    500, self.update_progress)
                return True
            else:
                try:
                    gobject.source_remove(self.__updater_id)
                except:
                    pass
                self.transcoder.pause()
                return True
        return False

    def set_progress_ratio(self, value):
        self.progress_ratio = value
        self.emit_redraw_request()

    def set_index(self, index):
        '''Update index.'''
        self.index = index

    def get_index(self):
        '''Get index.'''
        return self.index

    def __set_status_icon(self, name):
        self.status_icon = app_theme.get_pixbuf("transcoder/%s.png" %
                                                name).get_pixbuf()
        self.status_icon_press = app_theme.get_pixbuf(
            "transcoder/%s_press.png" % name).get_pixbuf()
        self.emit_redraw_request()

    def set_error_status(self):
        self.__set_status_icon("error")

    def emit_redraw_request(self):
        '''Emit redraw-request signal.'''
        self.emit("redraw-request")

    def render_icon(self, cr, rect, in_select, in_highlight):
        icon_x = rect.x + self.status_icon_padding_x
        icon_y = rect.y + (rect.height - self.status_icon_h) / 2
        if in_select:
            draw_pixbuf(cr, self.status_icon_press, icon_x, icon_y)
        else:
            draw_pixbuf(cr, self.status_icon, icon_x, icon_y)

    def render_title(self, cr, rect, in_select, in_highlight):
        rect.x += self.title_padding_x
        rect.width -= self.title_padding_x * 2
        render_item_text2(cr, self.title, rect, in_select, in_highlight)

    def render_progress(self, cr, rect, in_select, in_highlight):
        self.progress_buffer.progress = self.progress_ratio * 100
        progress_x = rect.x + self.progress_padding_x
        progress_y = rect.y + (rect.height - self.progress_h) / 2
        progress_rect = gtk.gdk.Rectangle(progress_x, progress_y,
                                          self.progress_w, self.progress_h)
        self.progress_buffer.render(cr, progress_rect)

    def render_stop(self, cr, rect, in_select, in_highlight):
        icon_x = rect.x + self.stop_icon_padding_x
        icon_y = rect.y + (rect.height - self.stop_icon_h) / 2
        draw_pixbuf(cr, self.stop_icon, icon_x, icon_y)

    def render_ext(self, cr, rect, in_select, in_highlight):
        rect.x += self.ext_padding_x
        rect.width -= self.ext_padding_x * 2
        render_item_text2(cr, self.output_ext.upper(), rect, in_select,
                          in_highlight)

    def get_ext_type(self):
        gio_file = gio.File(self.output_path)
        gio_file_info = gio_file.query_info(",".join([
            gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE,
            gio.FILE_ATTRIBUTE_STANDARD_TYPE,
            gio.FILE_ATTRIBUTE_STANDARD_NAME,
            gio.FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
            gio.FILE_ATTRIBUTE_STANDARD_SIZE,
            gio.FILE_ATTRIBUTE_STANDARD_ICON,
            gio.FILE_ATTRIBUTE_TIME_MODIFIED,
            gio.FILE_ATTRIBUTE_TIME_CHANGED,
        ]))

        info_attr = gio_file_info.get_attribute_as_string(
            gio.FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE)
        return gio.content_type_get_description(info_attr)

    def get_column_sizes(self):
        return [
            (36, self.status_icon_h + self.status_icon_padding_y * 2),
            (135, self.title_h + self.title_padding_y * 2),
            (120, self.progress_h + self.progress_padding_y * 2),
            # (26, self.stop_icon_h + self.stop_icon_padding_y * 2),
            (50, self.ext_h + self.ext_padding_y),
        ]

    def get_renders(self):
        return [
            self.render_icon, self.render_title, self.render_progress,
            self.render_ext
        ]
Example #16
0
from mutagen.mp3 import MP3
from mutagen.id3 import TPOS

sys.path.append(sys.path[0] + '/base')
from transcoder import Transcoder
from codec import *

sys.path.append(sys.path[0] + '/codecs')
from oggcodec import OggCodec
from mp3codec import MP3Codec


def CopyTags(source_file, target_file):
    o = OggVorbis(source_file)
    m = EasyID3(target_file)

    for key in ['artist', 'title', 'album', 'date', 'genre', 'tracknumber']:
        if o.has_key(key):
            m[key] = o[key]
    m.save()

    if o.has_key('discnumber'):
        m = MP3(target_file)
        m['TPOS'] = TPOS(encoding=3, text=o['discnumber'])
        m.save()


# Main
trans = Transcoder(OggCodec, MP3Codec, CopyTags)
trans.Go()
Example #17
0
#!/usr/bin/env python

import sys

sys.path.append(sys.path[0] + '/base')
from transcoder import Transcoder
from codec import *

sys.path.append(sys.path[0] + '/codecs')
from flaccodec import FLACCodec

# Main
trans = Transcoder(None, FLACCodec)
trans.Go()