Show
Ignore:
Timestamp:
02/13/08 17:30:57 (10 months ago)
Author:
mattn
Message:

lang/python/otolog4linux/trunk/src/plugin.py,
lang/python/otolog4linux/trunk/src/controller.py,
lang/python/otolog4linux/trunk/src/server.py,
lang/python/otolog4linux/trunk/otolog4linux,
lang/python/otolog4linux/trunk/setup.py,
lang/python/otolog4linux/trunk/data/plugins/jacket_playlog.py,
lang/python/otolog4linux/trunk/data/plugins/server_otolog.py,
lang/python/otolog4linux/trunk/data/plugins/player_mpc.py,
lang/python/otolog4linux/trunk/data/plugins/server_playlog.py,
lang/python/otolog4linux/trunk/data/plugins/player_kscd.py,
lang/python/otolog4linux/trunk/data/plugins/player_rhythmbox.py,
lang/python/otolog4linux/trunk/data/plugins/player_xmms.py,
lang/python/otolog4linux/trunk/data/plugins/player_itunes.py,
lang/python/otolog4linux/trunk/data/plugins/jacket_otolog.py,
lang/python/otolog4linux/trunk/data/plugins/jacket_amazon.py,
lang/python/otolog4linux/trunk/data/plugins/player_amarok.py,
lang/python/otolog4linux/trunk/data/otolog4linux_install.py,
lang/python/otolog4linux/trunk/data/otolog4linux_win32.pyw,
lang/python/otolog4linux/trunk/PKG-INFO:

  • change tab codes to space codes.
  • fixed hung about gtk.threads_init().
Location:
lang/python/otolog4linux/trunk
Files:
19 modified

Legend:

Unmodified
Added
Removed
  • lang/python/otolog4linux/trunk/PKG-INFO

    r2266 r6632  
    11Metadata-Version: 1.0 
    22Name: otolog4linux 
    3 Version: 0.04 
     3Version: 0.05 
    44Summary: otolog controller for linux 
    5 Home-page: http://www.ac.cyberhome.ne.jp/~mattn/ 
     5Home-page: http://mattn.kaoriya.net/ 
    66Author: Yasuhiro Matsumoto 
    77Author-email: mattn.jp@gmail.com 
  • lang/python/otolog4linux/trunk/data/otolog4linux_install.py

    r2266 r6632  
    33import os, sys 
    44if sys.platform == "win32": 
    5         target=os.path.join(sys.exec_prefix, "share", "otolog4linux", "otolog4linux_win32.pyw") 
    6         description="�����O for Linux" 
    7         shortcut=os.path.join(get_special_folder_path("CSIDL_DESKTOPDIRECTORY"), "otolog4linux.lnk") 
    8         iconpath=os.path.join(sys.exec_prefix, "share", "icons", "otolog4linux.wic") 
    9         workdir=sys.exec_prefix 
    10         create_shortcut(target,description,shortcut,"",workdir,iconpath,0) 
    11         print "Install complete" 
     5    target=os.path.join(sys.exec_prefix, "share", "otolog4linux", "otolog4linux_win32.pyw") 
     6    description="�����O for Linux" 
     7    shortcut=os.path.join(get_special_folder_path("CSIDL_DESKTOPDIRECTORY"), "otolog4linux.lnk") 
     8    iconpath=os.path.join(sys.exec_prefix, "share", "icons", "otolog4linux.wic") 
     9    workdir=sys.exec_prefix 
     10    create_shortcut(target,description,shortcut,"",workdir,iconpath,0) 
     11    print "Install complete" 
  • lang/python/otolog4linux/trunk/data/otolog4linux_win32.pyw

    r2266 r6632  
    44 
    55try: 
    6         import otolog4linux 
     6    import otolog4linux 
    77except: 
    8         import src 
    9         sys.modules['otolog4linux'] = src 
    10         import src.__init__ as otolog4linux 
     8    import src 
     9    sys.modules['otolog4linux'] = src 
     10    import src.__init__ as otolog4linux 
    1111 
    1212def usage(): 
    13         print '%s : %s' % (otolog4linux.app_name, otolog4linux.app_title) 
    14         print '  version %s' % otolog4linux.app_version 
    15         sys.exit(2) 
     13    print '%s : %s' % (otolog4linux.app_name, otolog4linux.app_title) 
     14    print '  version %s' % otolog4linux.app_version 
     15    sys.exit(2) 
    1616 
    1717player = None 
    1818try: 
    19         opts, args = getopt.getopt(sys.argv[1:], 'hp:v', ['help', 'player=']) 
     19    opts, args = getopt.getopt(sys.argv[1:], 'hp:v', ['help', 'player=']) 
    2020except getopt.GetoptError: 
    21         usage() 
     21    usage() 
    2222 
    2323for arg, val in opts: 
    24         if arg == '--help': 
    25                 usage() 
    26         if arg in ('-p', '--player'): 
    27                 player = val 
     24    if arg == '--help': 
     25        usage() 
     26    if arg in ('-p', '--player'): 
     27        player = val 
    2828 
    2929try: 
    30         otocon = otolog4linux.getInstance() 
    31         otocon.load_settings() 
    32         if player: 
    33                 otocon.settings['player'] = player 
    34         otocon.main() 
     30    otocon = otolog4linux.getInstance() 
     31    otocon.load_settings() 
     32    if player: 
     33        otocon.settings['player'] = player 
     34    otocon.main() 
    3535except Exception, e: 
    36         print(e) 
     36    print(e) 
  • lang/python/otolog4linux/trunk/data/plugins/jacket_amazon.py

    r2266 r6632  
    77 
    88def get_capability(): 
    9         return ['jacket'] 
     9    return ['jacket'] 
    1010 
    1111def get_name(): 
    12         return 'アマゾン' 
     12    return 'アマゾン' 
    1313 
    1414def get_settings(): 
    15         return [ 
    16                 ('Amazon ID', 'amazon_id'), 
    17                 ('Amazon Key', 'amazon_key'), 
    18         ] 
     15    return [ 
     16        ('Amazon ID', 'amazon_id'), 
     17        ('Amazon Key', 'amazon_key'), 
     18    ] 
    1919 
    2020def get_jacket(settings, player_info): 
    21         wsdl = 'http://soap.amazon.com/schemas3/AmazonWebServices.wsdl' 
    22         proxy = SOAPpy.WSDL.Proxy(wsdl) 
     21    wsdl = 'http://soap.amazon.com/schemas3/AmazonWebServices.wsdl' 
     22    proxy = SOAPpy.WSDL.Proxy(wsdl) 
    2323 
    24         _query = "%s %s" % (player_info['artist'], player_info['album']) 
    25         while True: 
    26                 pos1 = _query.find("(") 
    27                 pos2 = _query.find(")") 
    28                 if pos1 > 0 and pos1 < pos2: 
    29                         if pos2 < len(_query)-1: 
    30                                 _query = _query[:pos1-1] + _query[pos2:] 
    31                         else: 
    32                                 _query = _query[:pos1-1] 
    33                 else: 
    34                         break 
     24    _query = "%s %s" % (player_info['artist'], player_info['album']) 
     25    while True: 
     26        pos1 = _query.find("(") 
     27        pos2 = _query.find(")") 
     28        if pos1 > 0 and pos1 < pos2: 
     29            if pos2 < len(_query)-1: 
     30                _query = _query[:pos1-1] + _query[pos2:] 
     31            else: 
     32                _query = _query[:pos1-1] 
     33        else: 
     34            break 
    3535 
    36         #print _query 
    37         request = { 'keyword':  _query,  
    38                                 'page':     '1',  
    39                                 'mode':     'music-jp',  
    40                                 'tag':      settings['amazon_id'],  
    41                                 'type':     'lite',  
    42                                 'locale':   'jp',  
    43                                 'devtag':   settings['amazon_key'] } 
    44         results = proxy.KeywordSearchRequest(request) 
    45         if (results.TotalResults > 0): 
    46                 details = results.Details[0] 
    47                 player_info['asin'] = details['Asin'] 
    48                 for key in details._keys(): 
    49                         if key == 'ImageUrlMedium': 
    50                                 return details[key] 
    51                         elif key == 'ImageUrlLarge': 
    52                                 return details[key] 
    53                         elif key == 'ImageUrlSmall': 
    54                                 return details[key] 
    55         return None 
     36    #print _query 
     37    request = { 'keyword':  _query,  
     38                'page':     '1',  
     39                'mode':     'music-jp',  
     40                'tag':      settings['amazon_id'],  
     41                'type':     'lite',  
     42                'locale':   'jp',  
     43                'devtag':   settings['amazon_key'] } 
     44    results = proxy.KeywordSearchRequest(request) 
     45    if (results.TotalResults > 0): 
     46        details = results.Details[0] 
     47        player_info['asin'] = details['Asin'] 
     48        for key in details._keys(): 
     49            if key == 'ImageUrlMedium': 
     50                return details[key] 
     51            elif key == 'ImageUrlLarge': 
     52                return details[key] 
     53            elif key == 'ImageUrlSmall': 
     54                return details[key] 
     55    return None 
  • lang/python/otolog4linux/trunk/data/plugins/jacket_otolog.py

    r2266 r6632  
    55 
    66def get_capability(): 
    7         return ['jacket'] 
     7    return ['jacket'] 
    88 
    99def get_name(): 
    10         return '音ログ' 
     10    return '音ログ' 
    1111 
    1212def get_jacket(settings, player_info): 
    13         return 'http://jacketimg.otolog.jp/%s' % settings["userid"] 
     13    return 'http://jacketimg.otolog.jp/%s' % settings["userid"] 
  • lang/python/otolog4linux/trunk/data/plugins/jacket_playlog.py

    r2266 r6632  
    55 
    66def get_capability(): 
    7         return ['jacket'] 
     7    return ['jacket'] 
    88 
    99def get_name(): 
    10         return 'プレイログ' 
     10    return 'プレイログ' 
    1111 
    1212def get_jacket(settings, player_info): 
    13         return 'http://playlog.jp/_images/blog/D/e/Development/m_2467.jpg' 
     13    return 'http://playlog.jp/_images/blog/D/e/Development/m_2467.jpg' 
  • lang/python/otolog4linux/trunk/data/plugins/player_amarok.py

    r2266 r6632  
    88 
    99def get_capability(): 
    10         return ['player'] 
     10    return ['player'] 
    1111 
    1212def get_name(): 
    13         return 'AmaroK' 
     13    return 'AmaroK' 
    1414 
    1515# should be return supported version. 
     
    1717 
    1818def play(): 
    19         file = os.popen('dcop amarok player play') 
    20         res = file.readline()[:-1] 
    21         file.close() 
    22         print res 
     19    file = os.popen('dcop amarok player play') 
     20    res = file.readline()[:-1] 
     21    file.close() 
     22    print res 
    2323 
    2424def stop(): 
    25         file = os.popen('dcop amarok player stop') 
    26         res = file.readline()[:-1] 
    27         file.close() 
    28         print res 
     25    file = os.popen('dcop amarok player stop') 
     26    res = file.readline()[:-1] 
     27    file.close() 
     28    print res 
    2929 
    3030def pause(): 
    31         file = os.popen('dcop amarok player pause') 
    32         res = file.readline()[:-1] 
    33         file.close() 
    34         print res 
     31    file = os.popen('dcop amarok player pause') 
     32    res = file.readline()[:-1] 
     33    file.close() 
     34    print res 
    3535 
    3636def next(): 
    37         file = os.popen('dcop amarok player next') 
    38         res = file.readline()[:-1] 
    39         file.close() 
    40         print res 
     37    file = os.popen('dcop amarok player next') 
     38    res = file.readline()[:-1] 
     39    file.close() 
     40    print res 
    4141 
    4242def prev(): 
    43         file = os.popen('dcop amarok player prev') 
    44         res = file.readline()[:-1] 
    45         file.close() 
    46         print res 
     43    file = os.popen('dcop amarok player prev') 
     44    res = file.readline()[:-1] 
     45    file.close() 
     46    print res 
    4747 
    4848def get_info(settings): 
    49         info = {} 
    50         try: 
    51                 # Check amarok is working 
    52                 file = os.popen('dcop amarok player status 2> /dev/null') 
    53                 amarok_check = file.readline() 
    54                 file.close() 
    55                 if len(amarok_check): 
    56                         amarok_check = string.atoi(amarok_check[:-1]) 
    57                 else: 
    58                         amarok_check = 0 
    59                 if amarok_check == 256 or amarok_check == 0: 
    60                         return None 
    61                 file = os.popen('dcop amarok player album') 
    62                 info['album'] = file.readline()[:-1] 
    63                 file.close() 
    64                 file = os.popen('dcop amarok player artist') 
    65                 info['artist'] = file.readline()[:-1] 
    66                 file.close() 
    67                 file = os.popen('dcop amarok player title') 
    68                 info['track'] = file.readline()[:-1] 
    69                 file.close() 
    70                 file = os.popen('dcop amarok player trackTotalTime') 
    71                 info['duration'] = int(file.readline()[:-1]) 
    72                 file.close() 
    73                 if amarok_check == 2: 
    74                         info['status'] = True 
    75                 else: 
    76                         info['status'] = False 
    77         except Exception, e: 
    78                 print(e) 
    79         return info 
     49    info = {} 
     50    try: 
     51        # Check amarok is working 
     52        file = os.popen('dcop amarok player status 2> /dev/null') 
     53        amarok_check = file.readline() 
     54        file.close() 
     55        if len(amarok_check): 
     56            amarok_check = string.atoi(amarok_check[:-1]) 
     57        else: 
     58            amarok_check = 0 
     59        if amarok_check == 256 or amarok_check == 0: 
     60            return None 
     61        file = os.popen('dcop amarok player album') 
     62        info['album'] = file.readline()[:-1] 
     63        file.close() 
     64        file = os.popen('dcop amarok player artist') 
     65        info['artist'] = file.readline()[:-1] 
     66        file.close() 
     67        file = os.popen('dcop amarok player title') 
     68        info['track'] = file.readline()[:-1] 
     69        file.close() 
     70        file = os.popen('dcop amarok player trackTotalTime') 
     71        info['duration'] = int(file.readline()[:-1]) 
     72        file.close() 
     73        if amarok_check == 2: 
     74            info['status'] = True 
     75        else: 
     76            info['status'] = False 
     77    except Exception, e: 
     78        print(e) 
     79    return info 
    8080 
  • lang/python/otolog4linux/trunk/data/plugins/player_itunes.py

    r2266 r6632  
    88 
    99def get_capability(): 
    10         return ['player'] 
     10    return ['player'] 
    1111 
    1212def get_name(): 
    13         return 'iTunes' 
     13    return 'iTunes' 
    1414 
    1515# should be return supported version. 
     
    1717 
    1818def get_info(settings): 
    19         info = {} 
    20         pythoncom.CoInitialize() 
    21         try: 
    22                 iTunes = win32com.client.gencache.EnsureDispatch("iTunes.Application") 
    23                 if not iTunes: 
    24                         return {} 
    25                 Track = iTunes.CurrentTrack 
    26                 if not Track: 
    27                         return False 
    28                 info['artist'] = Track.Artist 
    29                 info['album'] = Track.Album 
    30                 info['track'] = Track.Name 
    31                 info['duration'] = Track.Duration 
    32                 if iTunes.PlayerState == 1: 
    33                         info['status'] = True 
    34                 else: 
    35                         info['status'] = False 
    36         except Exception, e: 
    37                 print(e) 
    38         pythoncom.CoUninitialize() 
    39         return info 
     19    info = {} 
     20    pythoncom.CoInitialize() 
     21    try: 
     22        iTunes = win32com.client.gencache.EnsureDispatch("iTunes.Application") 
     23        if not iTunes: 
     24            return {} 
     25        Track = iTunes.CurrentTrack 
     26        if not Track: 
     27            return False 
     28        info['artist'] = Track.Artist 
     29        info['album'] = Track.Album 
     30        info['track'] = Track.Name 
     31        info['duration'] = Track.Duration 
     32        if iTunes.PlayerState == 1: 
     33            info['status'] = True 
     34        else: 
     35            info['status'] = False 
     36    except Exception, e: 
     37        print(e) 
     38    pythoncom.CoUninitialize() 
     39    return info 
    4040 
  • lang/python/otolog4linux/trunk/data/plugins/player_kscd.py

    r2266 r6632  
    88 
    99def get_capability(): 
    10         return ['player'] 
     10    return ['player'] 
    1111 
    1212def get_name(): 
    13         return 'KsCD' 
     13    return 'KsCD' 
    1414 
    1515# should be return supported version. 
     
    1717 
    1818def play(): 
    19         file = os.popen('dcop kscd CDPlayer play') 
    20         res = file.readline()[:-1] 
    21         file.close() 
    22         print res 
     19    file = os.popen('dcop kscd CDPlayer play') 
     20    res = file.readline()[:-1] 
     21    file.close() 
     22    print res 
    2323 
    2424def stop(): 
    25         file = os.popen('dcop kscd CDPlayer stop') 
    26         res = file.readline()[:-1] 
    27         file.close() 
    28         print res 
     25    file = os.popen('dcop kscd CDPlayer stop') 
     26    res = file.readline()[:-1] 
     27    file.close() 
     28    print res 
    2929 
    3030def pause(): 
    31         sys.stderr.write('not implement!\n') 
     31    sys.stderr.write('not implement!\n') 
    3232 
    3333def next(): 
    34         file = os.popen('dcop kscd CDPlayer next') 
    35         res = file.readline()[:-1] 
    36         file.close() 
    37         print res 
     34    file = os.popen('dcop kscd CDPlayer next') 
     35    res = file.readline()[:-1] 
     36    file.close() 
     37    print res 
    3838 
    3939def prev(): 
    40         file = os.popen('dcop kscd CDPlayer previous') 
    41         res = file.readline()[:-1] 
    42         file.close() 
    43         print res 
     40    file = os.popen('dcop kscd CDPlayer previous') 
     41    res = file.readline()[:-1] 
     42    file.close() 
     43    print res 
    4444 
    4545def get_info(settings): 
    46         info = {} 
    47         try: 
    48                 # Check kscd is working 
    49                 file = os.popen('dcop kscd CDPlayer getStatus 2> /dev/null') 
    50                 kscd_check = file.readline() 
    51                 file.close() 
    52                 if len(kscd_check): 
    53                         kscd_check = string.atoi(kscd_check[:-1]) 
    54                 else: 
    55                         kscd_check = 0 
    56                 if kscd_check != 2 and kscd_check != 4: 
    57                         return None 
    58                 file = os.popen('dcop kscd CDPlayer currentAlbum') 
    59                 info['album'] = file.readline()[:-1] 
    60                 file.close() 
    61                 file = os.popen('dcop kscd CDPlayer currentArtist') 
    62                 info['artist'] = file.readline()[:-1] 
    63                 file.close() 
    64                 file = os.popen('dcop kscd CDPlayer currentTrackTitle') 
    65                 info['track'] = file.readline()[:-1] 
    66                 file.close() 
    67                 file = os.popen('dcop kscd CDPlayer currentTrackLength') 
    68                 duration = int(file.readline()[:-1]) 
    69                 info['duration'] = int(duration / 1000) 
    70                 file.close() 
    71                 if kscd_check == 2: 
    72                         info['status'] = True 
    73                 else: 
    74                         info['status'] = False 
    75         except Exception, e: 
    76                 print(e) 
    77         return info 
     46    info = {} 
     47    try: 
     48        # Check kscd is working 
     49        file = os.popen('dcop kscd CDPlayer getStatus 2> /dev/null') 
     50        kscd_check = file.readline() 
     51        file.close() 
     52        if len(kscd_check): 
     53            kscd_check = string.atoi(kscd_check[:-1]) 
     54        else: 
     55            kscd_check = 0 
     56        if kscd_check != 2 and kscd_check != 4: 
     57            return None 
     58        file = os.popen('dcop kscd CDPlayer currentAlbum') 
     59        info['album'] = file.readline()[:-1] 
     60        file.close() 
     61        file = os.popen('dcop kscd CDPlayer currentArtist') 
     62        info['artist'] = file.readline()[:-1] 
     63        file.close() 
     64        file = os.popen('dcop kscd CDPlayer currentTrackTitle') 
     65        info['track'] = file.readline()[:-1] 
     66        file.close() 
     67        file = os.popen('dcop kscd CDPlayer currentTrackLength') 
     68        duration = int(file.readline()[:-1]) 
     69        info['duration'] = int(duration / 1000) 
     70        file.close() 
     71        if kscd_check == 2: 
     72            info['status'] = True 
     73        else: 
     74            info['status'] = False 
     75    except Exception, e: 
     76        print(e) 
     77    return info 
    7878 
  • lang/python/otolog4linux/trunk/data/plugins/player_mpc.py

    r2266 r6632  
    88 
    99def get_capability(): 
    10         return ['player'] 
     10    return ['player'] 
    1111 
    1212def get_name(): 
    13         return 'mpc' 
     13    return 'mpc' 
    1414 
    1515# should be return supported version. 
     
    1717 
    1818def play(): 
    19         file = os.popen('mpc play') 
    20         res = file.readline()[:-1] 
    21         file.close() 
    22         print res 
     19    file = os.popen('mpc play') 
     20    res = file.readline()[:-1] 
     21    file.close() 
     22    print res 
    2323 
    2424def stop(): 
    25         file = os.popen('mpc stop') 
    26         res = file.readline()[:-1] 
    27         file.close() 
    28         print res 
     25    file = os.popen('mpc stop') 
     26    res = file.readline()[:-1] 
     27    file.close() 
     28    print res 
    2929 
    3030def pause(): 
    31         sys.stderr.write('mpc pause\n') 
     31    sys.stderr.write('mpc pause\n') 
    3232 
    3333def next(): 
    34         file = os.popen('mpc next') 
    35         res = file.readline()[:-1] 
    36         file.close() 
    37         print res 
     34    file = os.popen('mpc next') 
     35    res = file.readline()[:-1] 
     36    file.close() 
     37    print res 
    3838 
    3939def prev():