Changeset 313

Show
Ignore:
Timestamp:
06/17/06 19:20:26 (2 years ago)
Author:
nicfit
Message:

Refactor of audio_source module to mesk.audio.*, Ogg vorbis support, and misc goodness

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk

    • Property svn:ignore changed from
      .*.swp
      */.*.swp
      to
      .*.swp
      */.*.swp
      tags
      patches
  • trunk/Makefile.in

    r308 r313  
    143143        -rm -f configure 
    144144        -rm etc/mesk.1 
    145         -rm tags 
    146145        -rm ./etc/mesk.desktop 
    147146 
  • trunk/po/POTFILES.in

    r203 r313  
    1111src/main.py 
    1212src/main_window.py 
    13 src/mesk/audio_source.py 
     13src/mesk/audio/__init__.py 
     14src/mesk/audio/mp3.py 
     15src/mesk/audio/oggvorbis.py 
     16src/mesk/audio/source.py 
    1417src/mesk/common/config.py 
    1518src/mesk/common/i18n.py 
     
    2326src/mesk/plugin/listeners.py 
    2427src/mesk/utils.py 
     28src/mmkeys/setup.py 
     29src/multi_media_keys.py 
    2530src/playlist_control.py 
    2631src/plugins/audioscrobbler.py 
  • trunk/po/es.po

    r308 r313  
    88"Project-Id-Version: 0.1.1\n" 
    99"Report-Msgid-Bugs-To: \n" 
    10 "POT-Creation-Date: 2006-06-11 14:26-0600\n" 
     10"POT-Creation-Date: 2006-06-17 19:17-0600\n" 
    1111"PO-Revision-Date: 2006-04-15 17:38-0600\n" 
    1212"Last-Translator: Travis Shirk <travis@pobox.com>\n" 
     
    101101 
    102102#. Tooltip strings 
    103 #: ../src/mesk_gui.glade.h:20 ../src/audio_control.py:44 
     103#: ../src/mesk_gui.glade.h:20 ../src/audio_control.py:42 
    104104msgid "Play" 
    105105msgstr "Juego" 
     
    175175#. TRANSLATORS: Replace this string with your names, one name per line. 
    176176#: ../src/mesk_gui.glade.h:39 
    177 msgid "es: Travis Shirk (via Babelfish)
    178 msgstr "es: Travis Shirk (via Babelfish)
     177msgid "es: Babelfish
     178msgstr "
    179179 
    180180#: ../src/plugins/plugins_gui.glade.h:1 
     
    218218msgstr "Configuración de last.fm" 
    219219 
    220 #: ../src/audio_control.py:45 
     220#. XXX: How to get markup in the comments?? 
     221#. Dependency and format support 
     222#: ../src/about_dialog.py:39 
     223#, fuzzy 
     224msgid "Supported audio formats:" 
     225msgstr "Formato audio sin apoyo: %s" 
     226 
     227#: ../src/audio_control.py:43 
    221228msgid "Pause" 
    222229msgstr "Pausa" 
    223230 
    224 #: ../src/audio_control.py:122 
     231#: ../src/audio_control.py:120 
    225232#, python-format 
    226233msgid "Gstreamer version %d.%d.%d audio control initialized" 
     
    261268msgstr "La gerencia de la sesión inhabilitó (ningún módulo de gnome.ui)" 
    262269 
    263 #: ../src/main_window.py:69 ../src/main_window.py:302 
     270#: ../src/main_window.py:71 ../src/main_window.py:305 
    264271#, python-format 
    265272msgid "Volume %d%%" 
    266273msgstr "" 
    267274 
    268 #: ../src/main_window.py:84 
     275#: ../src/main_window.py:86 
    269276#, python-format 
    270277msgid "Error loading playlist '%s'" 
    271278msgstr "Playlist '%s' del cargamento del error" 
    272279 
    273 #: ../src/mesk/audio_source.py:32 
    274 msgid "Unknown" 
    275 msgstr "Desconocido" 
    276  
    277 #: ../src/mesk/audio_source.py:74 
    278 #, python-format 
    279 msgid "Error reading source metadata in '%s': %s" 
    280 msgstr "Metadata de la fuente de la lectura de error en '%s': %s" 
    281  
    282 #: ../src/mesk/audio_source.py:80 
    283 #, python-format 
    284 msgid "No metadata for file '%s'" 
    285 msgstr "Ningún metadata para el archivo '%s'" 
    286  
    287 #: ../src/mesk/audio_source.py:110 
    288 #, python-format 
    289 msgid "Unknown type: %s" 
    290 msgstr "Tipo desconocido: %s" 
    291  
    292 #: ../src/mesk/audio_source.py:111 
     280#: ../src/mesk/audio/__init__.py:58 
    293281#, python-format 
    294282msgid "Unsupported audio format: %s" 
    295283msgstr "Formato audio sin apoyo: %s" 
    296284 
    297 #: ../src/mesk/audio_source.py:115 
    298 #, python-format 
    299 msgid "Error loading source file %s" 
    300 msgstr "Archivo de fuente del cargamento del error %s" 
    301  
    302 #: ../src/mesk/audio_source.py:121 
    303 #, python-format 
    304 msgid "Unsupported audio URI scheme: %s" 
    305 msgstr "Esquema sin apoyo del audio URI: %s" 
     285#: ../src/mesk/audio/mp3.py:56 
     286#, fuzzy, python-format 
     287msgid "Error reading mp3 source for '%s': %s" 
     288msgstr "Metadata de la fuente de la lectura de error en '%s': %s" 
     289 
     290#: ../src/mesk/audio/oggvorbis.py:53 
     291#, fuzzy, python-format 
     292msgid "Error reading ogg/vorbis source for '%s': %s" 
     293msgstr "Metadata de la fuente de la lectura de error en '%s': %s" 
    306294 
    307295#: ../src/mesk/__init__.py:57 
     
    481469 
    482470#. Text columns 
    483 #: ../src/playlist_control.py:149 
     471#: ../src/playlist_control.py:150 
    484472msgid "Title" 
    485473msgstr "Título" 
    486474 
    487 #: ../src/playlist_control.py:150 
     475#: ../src/playlist_control.py:151 
    488476msgid "Artist" 
    489477msgstr "Artista" 
    490478 
    491 #: ../src/playlist_control.py:151 
     479#: ../src/playlist_control.py:152 
    492480msgid "Album" 
    493481msgstr "Álbum" 
    494482 
    495 #: ../src/playlist_control.py:152 
     483#: ../src/playlist_control.py:153 
    496484msgid "#" 
    497485msgstr "#" 
    498486 
    499 #: ../src/playlist_control.py:153 
     487#: ../src/playlist_control.py:154 
    500488msgid "Year" 
    501489msgstr "Año" 
    502490 
    503 #: ../src/playlist_control.py:154 
     491#: ../src/playlist_control.py:155 
    504492msgid "Time" 
    505493msgstr "Tiempo" 
    506494 
    507 #: ../src/playlist_control.py:485 
     495#: ../src/playlist_control.py:486 
    508496msgid "tracks" 
    509497msgstr "pistas" 
     
    531519msgstr "Agregue La Música" 
    532520 
    533 #: ../src/playlist_control.py:848 
    534 msgid "MP3s" 
    535 msgstr "MP3s" 
    536  
    537 #: ../src/playlist_control.py:853 
     521#: ../src/playlist_control.py:855 
    538522msgid "Playlists" 
    539523msgstr "Playlists" 
     
    542526#. the checkbox is toggles and files when not since this is not 
    543527#. possible by default 
    544 #: ../src/playlist_control.py:860 
     528#: ../src/playlist_control.py:869 
    545529msgid "Make the _dialog be able/unable to select directories" 
    546530msgstr "Haga que el _diálogo es able/unable para seleccionar directorios" 
    547531 
    548 #: ../src/playlist_control.py:952 
     532#: ../src/playlist_control.py:961 
    549533#, python-format 
    550534msgid "'%s' string not found" 
     
    681665msgstr "Error plugin de la desactivación" 
    682666 
     667#~ msgid "es: Travis Shirk (via Babelfish)" 
     668#~ msgstr "es: Travis Shirk (via Babelfish)" 
     669 
     670#~ msgid "Unknown" 
     671#~ msgstr "Desconocido" 
     672 
     673#~ msgid "No metadata for file '%s'" 
     674#~ msgstr "Ningún metadata para el archivo '%s'" 
     675 
     676#, fuzzy 
     677#~ msgid "Unknown file type: %s" 
     678#~ msgstr "Tipo desconocido: %s" 
     679 
     680#~ msgid "Error loading source file %s" 
     681#~ msgstr "Archivo de fuente del cargamento del error %s" 
     682 
     683#~ msgid "Unsupported audio URI scheme: %s" 
     684#~ msgstr "Esquema sin apoyo del audio URI: %s" 
     685 
     686#~ msgid "MP3s" 
     687#~ msgstr "MP3s" 
     688 
    683689#~ msgid "No GStreamer audio sink for '%s'" 
    684690#~ msgstr "Ningún fregadero audio de GStreamer para ' %s'" 
  • trunk/po/mesk.pot

    r308 r313  
    99"Project-Id-Version: PACKAGE VERSION\n" 
    1010"Report-Msgid-Bugs-To: \n" 
    11 "POT-Creation-Date: 2006-06-11 14:26-0600\n" 
     11"POT-Creation-Date: 2006-06-17 19:17-0600\n" 
    1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 
    1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 
     
    102102 
    103103#. Tooltip strings 
    104 #: ../src/mesk_gui.glade.h:20 ../src/audio_control.py:44 
     104#: ../src/mesk_gui.glade.h:20 ../src/audio_control.py:42 
    105105msgid "Play" 
    106106msgstr "" 
     
    176176#. TRANSLATORS: Replace this string with your names, one name per line. 
    177177#: ../src/mesk_gui.glade.h:39 
    178 msgid "es: Travis Shirk (via Babelfish)
     178msgid "es: Babelfish
    179179msgstr "" 
    180180 
     
    217217msgstr "" 
    218218 
    219 #: ../src/audio_control.py:45 
     219#. XXX: How to get markup in the comments?? 
     220#. Dependency and format support 
     221#: ../src/about_dialog.py:39 
     222msgid "Supported audio formats:" 
     223msgstr "" 
     224 
     225#: ../src/audio_control.py:43 
    220226msgid "Pause" 
    221227msgstr "" 
    222228 
    223 #: ../src/audio_control.py:122 
     229#: ../src/audio_control.py:120 
    224230#, python-format 
    225231msgid "Gstreamer version %d.%d.%d audio control initialized" 
     
    256262msgstr "" 
    257263 
    258 #: ../src/main_window.py:69 ../src/main_window.py:302 
     264#: ../src/main_window.py:71 ../src/main_window.py:305 
    259265#, python-format 
    260266msgid "Volume %d%%" 
    261267msgstr "" 
    262268 
    263 #: ../src/main_window.py:84 
     269#: ../src/main_window.py:86 
    264270#, python-format 
    265271msgid "Error loading playlist '%s'" 
    266272msgstr "" 
    267273 
    268 #: ../src/mesk/audio_source.py:32 
    269 msgid "Unknown" 
    270 msgstr "" 
    271  
    272 #: ../src/mesk/audio_source.py:74 
    273 #, python-format 
    274 msgid "Error reading source metadata in '%s': %s" 
    275 msgstr "" 
    276  
    277 #: ../src/mesk/audio_source.py:80 
    278 #, python-format 
    279 msgid "No metadata for file '%s'" 
    280 msgstr "" 
    281  
    282 #: ../src/mesk/audio_source.py:110 
    283 #, python-format 
    284 msgid "Unknown type: %s" 
    285 msgstr "" 
    286  
    287 #: ../src/mesk/audio_source.py:111 
     274#: ../src/mesk/audio/__init__.py:58 
    288275#, python-format 
    289276msgid "Unsupported audio format: %s" 
    290277msgstr "" 
    291278 
    292 #: ../src/mesk/audio_source.py:115 
    293 #, python-format 
    294 msgid "Error loading source file %s" 
    295 msgstr "" 
    296  
    297 #: ../src/mesk/audio_source.py:121 
    298 #, python-format 
    299 msgid "Unsupported audio URI scheme: %s" 
     279#: ../src/mesk/audio/mp3.py:56 
     280#, python-format 
     281msgid "Error reading mp3 source for '%s': %s" 
     282msgstr "" 
     283 
     284#: ../src/mesk/audio/oggvorbis.py:53 
     285#, python-format 
     286msgid "Error reading ogg/vorbis source for '%s': %s" 
    300287msgstr "" 
    301288 
     
    469456 
    470457#. Text columns 
    471 #: ../src/playlist_control.py:149 
     458#: ../src/playlist_control.py:150 
    472459msgid "Title" 
    473460msgstr "" 
    474461 
    475 #: ../src/playlist_control.py:150 
     462#: ../src/playlist_control.py:151 
    476463msgid "Artist" 
    477464msgstr "" 
    478465 
    479 #: ../src/playlist_control.py:151 
     466#: ../src/playlist_control.py:152 
    480467msgid "Album" 
    481468msgstr "" 
    482469 
    483 #: ../src/playlist_control.py:152 
     470#: ../src/playlist_control.py:153 
    484471msgid "#" 
    485472msgstr "" 
    486473 
    487 #: ../src/playlist_control.py:153 
     474#: ../src/playlist_control.py:154 
    488475msgid "Year" 
    489476msgstr "" 
    490477 
    491 #: ../src/playlist_control.py:154 
     478#: ../src/playlist_control.py:155 
    492479msgid "Time" 
    493480msgstr "" 
    494481 
    495 #: ../src/playlist_control.py:485 
     482#: ../src/playlist_control.py:486 
    496483msgid "tracks" 
    497484msgstr "" 
     
    517504msgstr "" 
    518505 
    519 #: ../src/playlist_control.py:848 
    520 msgid "MP3s" 
    521 msgstr "" 
    522  
    523 #: ../src/playlist_control.py:853 
     506#: ../src/playlist_control.py:855 
    524507msgid "Playlists" 
    525508msgstr "" 
     
    528511#. the checkbox is toggles and files when not since this is not 
    529512#. possible by default 
    530 #: ../src/playlist_control.py:860 
     513#: ../src/playlist_control.py:869 
    531514msgid "Make the _dialog be able/unable to select directories" 
    532515msgstr "" 
    533516 
    534 #: ../src/playlist_control.py:952 
     517#: ../src/playlist_control.py:961 
    535518#, python-format 
    536519msgid "'%s' string not found" 
  • trunk/setup.py.in

    r144 r313  
    1111            'mesk.common', 
    1212            'mesk.plugin', 
     13            'mesk.audio', 
    1314           ], 
    1415  package_dir={'mesk': 'src/mesk', 
    1516               'mesk.common': 'src/mesk/common', 
    1617               'mesk.plugin': 'src/mesk/plugin', 
     18               'mesk.audio': 'src/mesk/audio', 
    1719              } 
    1820) 
  • trunk/src/about_dialog.py

    r242 r313  
    2121 
    2222import mesk 
    23 _ = mesk.common.i18n.
     23from mesk.common.i18n import
    2424 
    2525class AboutDialog: 
     
    3131        self.dialog.set_license(mesk.info.GPLV2_LICENCE) 
    3232 
     33        img = gtk.Image() 
     34        img.set_from_file('images/mesk_felon.png') 
     35        self.dialog.set_logo(img.get_pixbuf()) 
     36 
     37        # XXX: How to get markup in the comments?? 
     38        # Dependency and format support 
     39        formats = '%s\n' % _('Supported audio formats:') 
     40        exts = mesk.audio.supported_extensions.keys() 
     41        exts.sort() 
     42        formats += ','.join(exts) 
     43        #for ext in mesk.audio.supported_extensions: 
     44        #    formats += '%s\n' % mt 
     45 
     46        self.dialog.set_comments(formats) 
     47 
  • trunk/src/audio_control.py

    r306 r313  
    2121import os, gobject 
    2222 
    23 import pygst 
    24 pygst.require('0.10') 
    2523import gst 
    2624 
     
    474472            src.meta_data.track_total = taglist['track-count'] 
    475473        if 'duration' in keys: 
    476             src.audio_info.time_secs = taglist['duration'] / gst.SECOND 
     474            src.meta_data.time_secs = taglist['duration'] / gst.SECOND 
    477475        self.emit('tag-update', src) 
    478476 
     
    524522            # _duration not used, it fluctuates and the label total should 
    525523            # be static 
    526             d = self._current_audio_src.audio_info.time_secs 
     524            d = self._current_audio_src.meta_data.time_secs 
    527525        else: 
    528526            p = d = 0 
  • trunk/src/mesk/__init__.py

    r306 r313  
    3434GLADE_XML = 'mesk_gui.glade' 
    3535 
    36 # Sections 
     36# Config sections 
    3737CONFIG_MAIN     = 'mesk' 
    3838CONFIG_UI       = 'ui' 
     
    127127import mesk.playlist 
    128128import mesk.utils 
    129 import mesk.audio_source 
     129import mesk.audio 
  • trunk/src/mesk/playlist.py

    r298 r313  
    2121import random 
    2222 
    23 import audio_source 
     23import audio.source 
    2424import utils 
    2525import log 
     
    4646            continue 
    4747        try: 
    48             src = audio_source.load(line) 
     48            src = audio.load(line) 
    4949        except Exception, ex: 
    5050            log.warn(str(ex)) 
  • trunk/src/mesk_gui.glade

    r306 r313  
    977977  <property name="authors">Travis Shirk &lt;travis@pobox.com&gt;</property> 
    978978  <property name="artists"></property> 
    979   <property name="translator_credits" translatable="yes" comments="TRANSLATORS: Replace this string with your names, one name per line.">es: Travis Shirk (via Babelfish)</property> 
     979  <property name="translator_credits" translatable="yes" comments="TRANSLATORS: Replace this string with your names, one name per line.">es: Babelfish</property> 
    980980</widget> 
    981981 
  • trunk/src/playlist_control.py

    r311 r313  
    2828 
    2929import gtk_utils, config, control 
    30 from mesk.audio_source import UnsupportedFormat 
     30from mesk.audio import UnsupportedFormat 
     31from mesk.audio.source import UnsupportedScheme 
    3132 
    3233# Data model.  These do not have to correspond to the column order, nor 
     
    230231        row_data[MODEL_NUM] = track_num 
    231232 
    232         duration = mesk.utils.format_track_time(src.audio_info.time_secs) 
     233        duration = mesk.utils.format_track_time(src.meta_data.time_secs) 
    233234        row_data[MODEL_TIME] = duration 
    234235         
     
    468469 
    469470            for src in self._playlist: 
    470                 if src.audio_info.time_secs is not None: 
    471                     self._list_secs += src.audio_info.time_secs 
    472                 if src.audio_info.size_bytes is not None: 
    473                     self._list_bytes += src.audio_info.size_bytes 
     471                if src.meta_data.time_secs is not None: 
     472                    self._list_secs += src.meta_data.time_secs 
     473                if src.meta_data.size_bytes is not None: 
     474                    self._list_bytes += src.meta_data.size_bytes 
    474475        else: 
    475476            if count_inc: 
     
    517518 
    518519            src = self._playlist[row] 
    519             byte_count += src.audio_info.size_bytes or 0 
    520             sec_count += src.audio_info.time_secs or 0 
     520            byte_count += src.meta_data.size_bytes or 0 
     521            sec_count += src.meta_data.time_secs or 0 
    521522 
    522523            # The rows are in ascending order, so each will adjust as we delete 
     
    771772                            del pl 
    772773                        else: 
    773                             src = mesk.audio_source.load(uri) 
     774                            src = mesk.audio.load(uri) 
    774775                            srcs.append(src) 
    775776                    except UnsupportedFormat, ex: 
     
    786787                            while gtk.events_pending(): 
    787788                                gtk.main_iteration(False) 
    788             except (mesk.audio_source.UnsupportedScheme, 
    789                     Exception), ex: 
     789            except (UnsupportedScheme, Exception), ex: 
    790790                msg = _('Error dropping source: %s\n\n%s') % (uri.path, str(ex)) 
    791791                mesk.log.error(msg) 
     
    825825 
    826826        self._update_playlist_stats(count_inc=1, 
    827                                     size_bytes_inc=src.audio_info.size_bytes, 
    828                                     time_secs_inc=src.audio_info.time_secs) 
     827                                    size_bytes_inc=src.meta_data.size_bytes, 
     828                                    time_secs_inc=src.meta_data.time_secs) 
    829829        self.emit('playlist_changed') 
    830830        return new_row 
     
    845845        dialog.set_current_folder(self._pl_config.file_add_dir) 
    846846 
     847        filters = [] 
    847848        mp3_filter = gtk.FileFilter() 
    848         mp3_filter.set_name(_('MP3s')
     849        mp3_filter.set_name('MP3s'
    849850        mp3_filter.add_pattern('*.mp3') 
    850851        dialog.add_filter(mp3_filter) 
     852        filters.append(mp3_filter) 
    851853 
    852854        m3u_filter = gtk.FileFilter() 
     
    854856        m3u_filter.add_pattern('*.m3u') 
    855857        dialog.add_filter(m3u_filter) 
     858        filters.append(m3u_filter) 
     859 
     860        ogg_filter = gtk.FileFilter() 
     861        ogg_filter.set_name('Oggs') 
     862        ogg_filter.add_pattern('*.ogg') 
     863        dialog.add_filter(ogg_filter) 
     864        filters.append(ogg_filter) 
    856865 
    857866        # This madness allows the file dialog to select directories when 
     
    864873            if button.get_active(): 
    865874                dialog.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER) 
    866                 dialog.remove_filter(mp3_filter) 
    867                 dialog.remove_filter(m3u_filter
     875                for f in filters: 
     876                    dialog.remove_filter(f
    868877            else: 
    869878                dialog.set_action(gtk.FILE_CHOOSER_ACTION_OPEN) 
    870                 dialog.add_filter(mp3_filter) 
    871                 dialog.add_filter(m3u_filter
     879                for f in filters: 
     880                    dialog.add_filter(f
    872881        dir_check.connect('toggled', on_toggled, dialog) 
    873882 
  • trunk/src/plugins/audioscrobbler.py

    r298 r313  
    393393        if audio_src: 
    394394            # Half the song or 240s, whichever is shorter 
    395             src_len = audio_src.audio_info.time_secs 
     395            src_len = audio_src.meta_data.time_secs 
    396396            if src_len < 30: 
    397397                self.log.info(_('Source length %s < 30s, skipping') % \ 
     
    426426        post['b[%(index)d]'] = album.encode('utf-8') 
    427427        post['m[%(index)d]'] = '' 
    428         post['l[%(index)d]'] = str(audio_src.audio_info.time_secs) 
     428        post['l[%(index)d]'] = str(audio_src.meta_data.time_secs) 
    429429        post['i[%(index)d]'] = self.time_stamp() 
    430430