Changeset 393

Show
Ignore:
Timestamp:
08/20/06 16:22:21 (2 years ago)
Author:
nicfit
Message:

Fetch remote playlists (#203)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/launch.sh

    r308 r393  
    11#!/bin/sh 
     2 
     3die() 
     4{ 
     5    echo "$1" 
     6    exit 1 
     7} 
    28 
    39ROOT=`dirname $0` 
    410cd $ROOT 
    511if test ! -e ./src/mesk/info.py; then 
    6     ./autogen.sh 
     12    ./autogen.sh || die 
     13    make || die 
    714fi 
    815 
  • trunk/po/es.po

    r391 r393  
    88"Project-Id-Version: 0.1.1\n" 
    99"Report-Msgid-Bugs-To: \n" 
    10 "POT-Creation-Date: 2006-08-19 17:25-0600\n" 
     10"POT-Creation-Date: 2006-08-20 16:21-0600\n" 
    1111"PO-Revision-Date: 2006-04-15 17:38-0600\n" 
    1212"Last-Translator: Travis Shirk <travis@pobox.com>\n" 
     
    230230msgstr "" 
    231231 
     232#: ../src/audio_control.py:665 
     233msgid "Mute Volume" 
     234msgstr "" 
     235 
    232236#: ../src/audio_control.py:667 
    233 msgid "Mute Volume" 
    234 msgstr "" 
    235  
    236 #: ../src/audio_control.py:669 
    237237msgid "Restore Volume" 
    238238msgstr "" 
     
    257257"DEBUG" 
    258258 
    259 #: ../src/main.py:168 
     259#. Developer options 
     260#: ../src/main.py:167 
     261msgid "Developer Options" 
     262msgstr "" 
     263 
     264#: ../src/main.py:170 
    260265msgid "Run using python profiler." 
    261266msgstr "" 
    262267 
    263 #: ../src/main.py:171 
     268#: ../src/main.py:173 
    264269msgid "Run using python debugger." 
    265270msgstr "" 
     
    270275msgstr "Playlist '%s' del cargamento del error" 
    271276 
    272 #: ../src/mesk/audio/__init__.py:89 
     277#: ../src/mesk/audio/__init__.py:88 
    273278#, python-format 
    274279msgid "Unsupported audio format: %s" 
     
    358363 
    359364#: ../src/mesk/__init__.py:85 
    360 msgid "Display the close button on each tab" 
     365msgid "Display a close button on each tab" 
    361366msgstr "" 
    362367 
     
    481486 
    482487#. Text columns 
    483 #: ../src/playlist_control.py:171 
     488#: ../src/playlist_control.py:170 
    484489msgid "Title" 
    485490msgstr "Título" 
    486491 
    487 #: ../src/playlist_control.py:172 
     492#: ../src/playlist_control.py:171 
    488493msgid "Artist" 
    489494msgstr "Artista" 
    490495 
    491 #: ../src/playlist_control.py:173 
     496#: ../src/playlist_control.py:172 
    492497msgid "Album" 
    493498msgstr "Álbum" 
    494499 
    495 #: ../src/playlist_control.py:174 
     500#: ../src/playlist_control.py:173 
    496501msgid "#" 
    497502msgstr "#" 
    498503 
    499 #: ../src/playlist_control.py:175 
     504#: ../src/playlist_control.py:174 
    500505msgid "Year" 
    501506msgstr "Año" 
    502507 
    503 #: ../src/playlist_control.py:176 
     508#: ../src/playlist_control.py:175 
    504509msgid "Time" 
    505510msgstr "Tiempo" 
    506511 
    507 #: ../src/playlist_control.py:454 
     512#: ../src/playlist_control.py:453 
    508513#, python-format 
    509514msgid "Are you sure you want to delete playlist '%s'?" 
    510515msgstr "" 
    511516 
    512 #: ../src/playlist_control.py:456 
     517#: ../src/playlist_control.py:455 
    513518msgid "All playlist data will be lost." 
    514519msgstr "" 
    515520 
    516 #: ../src/playlist_control.py:634 
     521#: ../src/playlist_control.py:633 
    517522msgid "tracks" 
    518523msgstr "pistas" 
    519524 
    520 #: ../src/playlist_control.py:986 
     525#: ../src/playlist_control.py:983 
    521526#, fuzzy, python-format 
    522527msgid "" 
     
    526531msgstr "Fuente que cae del error: %s" 
    527532 
    528 #: ../src/playlist_control.py:994 
     533#: ../src/playlist_control.py:991 
    529534#, fuzzy, python-format 
    530535msgid "" 
     
    536541"%s" 
    537542 
    538 #: ../src/playlist_control.py:1049 
     543#: ../src/playlist_control.py:1046 
    539544msgid "Add Music" 
    540545msgstr "Agregue La Música" 
    541546 
     547#: ../src/playlist_control.py:1063 
     548msgid "All" 
     549msgstr "" 
     550 
     551#: ../src/playlist_control.py:1065 
     552msgid "Audio" 
     553msgstr "" 
     554 
    542555#: ../src/playlist_control.py:1066 
    543 msgid "All" 
    544 msgstr "" 
    545  
    546 #: ../src/playlist_control.py:1068 
    547 msgid "Audio" 
    548 msgstr "" 
    549  
    550 #: ../src/playlist_control.py:1069 
    551556msgid "Playlists" 
    552557msgstr "Playlists" 
     
    555560#. the checkbox is toggles and files when not since this is not 
    556561#. possible by default 
    557 #: ../src/playlist_control.py:1074 
     562#: ../src/playlist_control.py:1071 
    558563msgid "Make the _dialog be able/unable to select directories" 
    559564msgstr "Haga que el _diálogo es able/unable para seleccionar directorios" 
    560565 
    561 #: ../src/playlist_control.py:1197 
     566#: ../src/playlist_control.py:1194 
    562567#, python-format 
    563568msgid "'%s' string not found" 
  • trunk/po/mesk.pot

    r391 r393  
    99"Project-Id-Version: PACKAGE VERSION\n" 
    1010"Report-Msgid-Bugs-To: \n" 
    11 "POT-Creation-Date: 2006-08-19 17:25-0600\n" 
     11"POT-Creation-Date: 2006-08-20 16:21-0600\n" 
    1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 
    1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" 
     
    224224msgstr "" 
    225225 
     226#: ../src/audio_control.py:665 
     227msgid "Mute Volume" 
     228msgstr "" 
     229 
    226230#: ../src/audio_control.py:667 
    227 msgid "Mute Volume" 
    228 msgstr "" 
    229  
    230 #: ../src/audio_control.py:669 
    231231msgid "Restore Volume" 
    232232msgstr "" 
     
    247247msgstr "" 
    248248 
    249 #: ../src/main.py:168 
     249#. Developer options 
     250#: ../src/main.py:167 
     251msgid "Developer Options" 
     252msgstr "" 
     253 
     254#: ../src/main.py:170 
    250255msgid "Run using python profiler." 
    251256msgstr "" 
    252257 
    253 #: ../src/main.py:171 
     258#: ../src/main.py:173 
    254259msgid "Run using python debugger." 
    255260msgstr "" 
     
    260265msgstr "" 
    261266 
    262 #: ../src/mesk/audio/__init__.py:89 
     267#: ../src/mesk/audio/__init__.py:88 
    263268#, python-format 
    264269msgid "Unsupported audio format: %s" 
     
    343348 
    344349#: ../src/mesk/__init__.py:85 
    345 msgid "Display the close button on each tab" 
     350msgid "Display a close button on each tab" 
    346351msgstr "" 
    347352 
     
    465470 
    466471#. Text columns 
     472#: ../src/playlist_control.py:170 
     473msgid "Title" 
     474msgstr "" 
     475 
    467476#: ../src/playlist_control.py:171 
    468 msgid "Title
     477msgid "Artist
    469478msgstr "" 
    470479 
    471480#: ../src/playlist_control.py:172 
    472 msgid "Artist
     481msgid "Album
    473482msgstr "" 
    474483 
    475484#: ../src/playlist_control.py:173 
    476 msgid "Album
     485msgid "#
    477486msgstr "" 
    478487 
    479488#: ../src/playlist_control.py:174 
    480 msgid "#
     489msgid "Year
    481490msgstr "" 
    482491 
    483492#: ../src/playlist_control.py:175 
    484 msgid "Year" 
    485 msgstr "" 
    486  
    487 #: ../src/playlist_control.py:176 
    488493msgid "Time" 
    489494msgstr "" 
    490495 
    491 #: ../src/playlist_control.py:454 
     496#: ../src/playlist_control.py:453 
    492497#, python-format 
    493498msgid "Are you sure you want to delete playlist '%s'?" 
    494499msgstr "" 
    495500 
    496 #: ../src/playlist_control.py:456 
     501#: ../src/playlist_control.py:455 
    497502msgid "All playlist data will be lost." 
    498503msgstr "" 
    499504 
    500 #: ../src/playlist_control.py:634 
     505#: ../src/playlist_control.py:633 
    501506msgid "tracks" 
    502507msgstr "" 
    503508 
    504 #: ../src/playlist_control.py:986 
     509#: ../src/playlist_control.py:983 
    505510#, python-format 
    506511msgid "" 
     
    510515msgstr "" 
    511516 
    512 #: ../src/playlist_control.py:994 
     517#: ../src/playlist_control.py:991 
    513518#, python-format 
    514519msgid "" 
     
    518523msgstr "" 
    519524 
    520 #: ../src/playlist_control.py:1049 
     525#: ../src/playlist_control.py:1046 
    521526msgid "Add Music" 
    522527msgstr "" 
    523528 
     529#: ../src/playlist_control.py:1063 
     530msgid "All" 
     531msgstr "" 
     532 
     533#: ../src/playlist_control.py:1065 
     534msgid "Audio" 
     535msgstr "" 
     536 
    524537#: ../src/playlist_control.py:1066 
    525 msgid "All" 
    526 msgstr "" 
    527  
    528 #: ../src/playlist_control.py:1068 
    529 msgid "Audio" 
    530 msgstr "" 
    531  
    532 #: ../src/playlist_control.py:1069 
    533538msgid "Playlists" 
    534539msgstr "" 
     
    537542#. the checkbox is toggles and files when not since this is not 
    538543#. possible by default 
    539 #: ../src/playlist_control.py:1074 
     544#: ../src/playlist_control.py:1071 
    540545msgid "Make the _dialog be able/unable to select directories" 
    541546msgstr "" 
    542547 
    543 #: ../src/playlist_control.py:1197 
     548#: ../src/playlist_control.py:1194 
    544549#, python-format 
    545550msgid "'%s' string not found" 
  • trunk/src/audio_control.py

    r392 r393  
    531531        position, self._duration = self.get_position() 
    532532        if position != gst.CLOCK_TIME_NONE: 
    533             value = position * 100.0 / self._duration 
     533            if self._duration: 
     534                value = position * 100.0 / self._duration 
     535            else: 
     536                value = 0 
    534537            self._set_track_scale(value) 
    535538 
  • trunk/src/mesk/__init__.py

    r392 r393  
    8282    'compact_main_window_pos_y': [int, -1,  
    8383                                  _('Main window y origin in compact mode')], 
    84     'show_tab_close_button': [int, 1,  
    85                               _('Display the close button on each tab')], 
     84    'show_tab_close_button': [bool, False,  
     85                              _('Display a close button on each tab')], 
    8686    'show_tip_window_on_startup': [bool, True, 
    8787                                   _('Show tips window each time Mesk is ' 
  • trunk/src/mesk/playlist.py

    r391 r393  
    2222 
    2323import audio.source 
    24 import utils 
    25 import log 
     24import utils, uri, log 
    2625 
    2726# Mapping from mime types to factory classes for supported formats 
     
    3029supported_extensions = ['m3u'] 
    3130 
    32 def load(pl_source): 
     31def load(pl_uri): 
    3332    '''Load a playlist, currently only m3u is supported''' 
     33    pl_path = uri.unescape(pl_uri.path) 
     34    if os.path.splitext(pl_path)[1] != '.m3u': 
     35        raise PlaylistException('Unsupported playlist type') 
     36 
    3437    pl = Playlist() 
    35     if os.path.splitext(pl_source)[1] == '.m3u': 
    36         if not os.path.exists(pl_source): 
    37             fp = file(pl_source, 'w') 
     38    if pl_uri.scheme == 'file': 
     39        if not os.path.exists(pl_path): 
     40            # Create local playlist if necessary 
     41            fp = file(pl_path, 'w') 
    3842            fp.close() 
    39         load_m3u(pl_source, pl) 
     43        else: 
     44            fp = file(pl_path, 'r') 
     45            load_m3u(fp, pl) 
     46            fp.close() 
    4047    else: 
    41         raise PlaylistException('Unsupported playlist type') 
     48        import urllib2 
     49        http_pl = urllib2.urlopen(str(pl_uri)) 
     50        load_m3u(http_pl, pl) 
     51        http_pl.close() 
     52 
    4253    return pl 
    4354 
    44 def load_m3u(pl_file, pl): 
    45     fp = file(pl_file, 'r') 
     55def load_m3u(pl_data, pl): 
     56    '''Load an m3u in pl.  pl_data must support readlines()''' 
    4657 
    4758    meta_time = 0 
     
    4960    meta_artist = u'' 
    5061 
    51     for line in fp
     62    for line in pl_data.readlines()
    5263        line = line.strip() 
    5364        if not line: 
     
    8899        meta_title = u'' 
    89100        meta_artist = u'' 
    90     fp.close() 
    91101 
    92102def save_m3u(pl_file, pl): 
  • trunk/src/playlist_control.py

    r392 r393  
    176176 
    177177        # Load playlist 
    178         pl = mesk.playlist.load(mesk.uri.unescape(self._pl_config.uri.path)
     178        pl = mesk.playlist.load(self._pl_config.uri
    179179        pl.set_shuffle(self._pl_config.shuffle) 
    180180        pl.set_repeat(self._pl_config.repeat) 
     
    726726        print "I'm called!!!!!!!!!!!!!!!!!!!!!" 
    727727        return self._on_playlist_control_key_press_event(widget, event) 
     728 
    728729    def _on_playlist_view_key_press_event(self, widget, event): 
    729730        # This handler is for key press events on just the treeview,  
     
    959960                    try: 
    960961                        if ext == '.m3u': 
    961                             # TODO: This may be remote, fetching would be nice 
    962  
    963962                            # Playlists 
    964                             pl = mesk.playlist.Playlist() 
    965                             pl = mesk.playlist.load(uri_path) 
     963                            pl = mesk.playlist.load(uri) 
    966964                            for src in pl: 
    967965                                srcs.append(src)