Ticket #784: fix.patch

File fix.patch, 5.9 kB (added by paol, 4 months ago)

patch (multi-file, apply in project root)

  • src/widget/webinfo/lyrics.py

     
    251251                os.unlink(song.lyric_uri) 
    252252            vfs.makedirs( song.lyric_uri[:self.song.lyric_uri.rfind("/")] ) 
    253253            try: 
    254                 f = file(vfs.get_local_path_from_uri(song.lyric_uri),"w") 
     254                f = file(vfs.get_path_from_uri(song.lyric_uri),"w") 
    255255            except:pass 
    256256            else: 
    257257                f.write( html ) 
  • src/song.py

     
    773773    Some filename manipulation 
    774774    """ 
    775775    def get_path(self): 
    776         try: return vfs.get_local_path_from_uri(self.get("uri")) 
     776        try: return vfs.get_path_from_uri(self.get("uri")) 
    777777        except : return "" 
    778778 
    779779    def get_scheme(self): 
  • src/vfs/vfsutils.py

     
    5151 
    5252def islocaldir(uri): 
    5353    if not get_scheme(uri) == "file": return False 
    54     else: return os.path.isdir(get_local_path_from_uri(uri)) 
     54    else: return os.path.isdir(get_path_from_uri(uri)) 
    5555 
    5656def get_mime_type(uri): 
    5757    # Minimum mime_type support for webradio 
     
    6565def read_entire_file(uri): 
    6666    data = "" 
    6767    if get_scheme(uri) == "file": 
    68         f = file(get_local_path_from_uri(uri),"r") 
     68        f = file(get_path_from_uri(uri),"r") 
    6969        data = f.read() 
    7070        f.close() 
    7171    else: 
     
    8686        return "file://"+pathname2url(os.path.abspath(os.path.expanduser(arg))) 
    8787 
    8888def get_name(value): 
    89     value = re.sub("^([A-Za-z]+):///+", "\\1:///", value) 
    90     return urlparse(value)[2].split("/")[-1] 
     89    return get_path_from_uri(value).split("/")[-1] 
    9190 
    92 def get_local_path_from_uri(value): 
    93     value = re.sub("^([A-Za-z]+):///+", "\\1:///", value) 
     91def get_path_from_uri(value): 
     92    if get_scheme(value) == "file": 
     93        # escape "#" otherwise it will be interpreted as a url fragment by urlparse 
     94        value = value.replace("#", "%23") 
    9495    return unquote(urlparse(value)[2]) 
    9596 
    9697def unescape_string_for_display(value): 
     
    99100def unlink(uri): 
    100101    if get_scheme(uri) != "file": return True 
    101102    else: 
    102         path = get_local_path_from_uri(uri) 
     103        path = get_path_from_uri(uri) 
    103104        return os.unlink(path) 
    104105 
    105106def exists(uri): 
    106107    if get_scheme(uri) != "file": return True 
    107108    else: 
    108         path = get_local_path_from_uri(uri) 
     109        path = get_path_from_uri(uri) 
    109110        return os.path.exists(path) 
    110111 
    111112def makedirs(uri,mode=0755): 
     
    162163""" Return all folder in a folder excepted hidden one """ 
    163164def get_folder_in_folder(dir): 
    164165    dirs = set() 
    165     alldirs = [ get_local_path_from_uri(dir) ] 
     166    alldirs = [ get_path_from_uri(dir) ] 
    166167    for mdir in alldirs: 
    167168        for dirpath, dirs, names in os.walk(mdir): 
    168169            [ dirs.remove(dir) for dir in dirs if dir[0] == "." ] 
     
    173174 
    174175""" Return all uri in a folder excepted hidden one """ 
    175176def parse_folder(dir): 
    176     dir = get_local_path_from_uri(dir) 
     177    dir = get_path_from_uri(dir) 
    177178    uris = [ "file://"+os.path.join(dir,name) for name in os.listdir(dir) if name[0] != "." and os.path.isfile(os.path.join(dir,name)) ] 
    178179    print "W:Utils:ParseFolder:",len(uris),"founds" 
    179180    return uris 
     
    287288    return parse_uris(uris,True,True,func_cb,*param) 
    288289 
    289290def move_to_trash(uri): 
    290     path = get_local_path_from_uri(uri) 
     291    path = get_path_from_uri(uri) 
    291292    path = os.path.realpath(os.path.expanduser(path)) 
    292293    if not os.path.exists(path): return False 
    293294    #find the trash folder 
  • src/source/local.py

     
    167167        added = [] 
    168168        db_uris = set(ListenDB.get_all_uris()) 
    169169 
    170         alldirs = [ vfs.get_local_path_from_uri(dir) for dir in dirs ] 
     170        alldirs = [ vfs.get_path_from_uri(dir) for dir in dirs ] 
    171171        last_estimated = estimated = 0  
    172172        total_dirs = len(alldirs) 
    173173        parsed_dirs = 0 
  • src/source/ipod.py

     
    142142                track.remember_playback_position = 0x00 
    143143                track.flag4 = 0x00 # Show Title/Album/Artist on the 'Now Playing' page 
    144144 
    145             filename = str(vfs.get_local_path_from_uri(tmp_uri)) 
     145            filename = str(vfs.get_path_from_uri(tmp_uri)) 
    146146 
    147147            for ltag,itag in IPOD_IDS.iteritems(): 
    148148                real_itag = itag.replace("@","").replace("#","") 
     
    205205            self.__current_transcode.stop() 
    206206        self.__current_transcode = None 
    207207        if self.uri_convert: 
    208             try: os.unlink(vfs.get_local_path_from_uri(self.uri_convert)) 
     208            try: os.unlink(vfs.get_path_from_uri(self.uri_convert)) 
    209209            except: pass 
    210210        self.cond.acquire() 
    211211        self.loginfo("%d song deleted from queue",len(self.__transfer_list)) 
  • src/source/podcast.py

     
    360360                if self.debug: print "I:PodcastDownloadJob:Start download:",uri 
    361361                proxy = discover_http_proxy() 
    362362                handle_read = urllib.urlopen(uri,None,proxy) 
    363                 handle_write = file(vfs.get_local_path_from_uri(new_uri),"w") 
     363                handle_write = file(vfs.get_path_from_uri(new_uri),"w") 
    364364                info = handle_read.info() 
    365365             
    366366                try: totalsize = int(info.getheader("content-length"))