Ticket #784: fix.patch
| File fix.patch, 5.9 kB (added by paol, 4 months ago) |
|---|
-
src/widget/webinfo/lyrics.py
251 251 os.unlink(song.lyric_uri) 252 252 vfs.makedirs( song.lyric_uri[:self.song.lyric_uri.rfind("/")] ) 253 253 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") 255 255 except:pass 256 256 else: 257 257 f.write( html ) -
src/song.py
773 773 Some filename manipulation 774 774 """ 775 775 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")) 777 777 except : return "" 778 778 779 779 def get_scheme(self): -
src/vfs/vfsutils.py
51 51 52 52 def islocaldir(uri): 53 53 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)) 55 55 56 56 def get_mime_type(uri): 57 57 # Minimum mime_type support for webradio … … 65 65 def read_entire_file(uri): 66 66 data = "" 67 67 if get_scheme(uri) == "file": 68 f = file(get_ local_path_from_uri(uri),"r")68 f = file(get_path_from_uri(uri),"r") 69 69 data = f.read() 70 70 f.close() 71 71 else: … … 86 86 return "file://"+pathname2url(os.path.abspath(os.path.expanduser(arg))) 87 87 88 88 def 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] 91 90 92 def get_local_path_from_uri(value): 93 value = re.sub("^([A-Za-z]+):///+", "\\1:///", value) 91 def 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") 94 95 return unquote(urlparse(value)[2]) 95 96 96 97 def unescape_string_for_display(value): … … 99 100 def unlink(uri): 100 101 if get_scheme(uri) != "file": return True 101 102 else: 102 path = get_ local_path_from_uri(uri)103 path = get_path_from_uri(uri) 103 104 return os.unlink(path) 104 105 105 106 def exists(uri): 106 107 if get_scheme(uri) != "file": return True 107 108 else: 108 path = get_ local_path_from_uri(uri)109 path = get_path_from_uri(uri) 109 110 return os.path.exists(path) 110 111 111 112 def makedirs(uri,mode=0755): … … 162 163 """ Return all folder in a folder excepted hidden one """ 163 164 def get_folder_in_folder(dir): 164 165 dirs = set() 165 alldirs = [ get_ local_path_from_uri(dir) ]166 alldirs = [ get_path_from_uri(dir) ] 166 167 for mdir in alldirs: 167 168 for dirpath, dirs, names in os.walk(mdir): 168 169 [ dirs.remove(dir) for dir in dirs if dir[0] == "." ] … … 173 174 174 175 """ Return all uri in a folder excepted hidden one """ 175 176 def parse_folder(dir): 176 dir = get_ local_path_from_uri(dir)177 dir = get_path_from_uri(dir) 177 178 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)) ] 178 179 print "W:Utils:ParseFolder:",len(uris),"founds" 179 180 return uris … … 287 288 return parse_uris(uris,True,True,func_cb,*param) 288 289 289 290 def move_to_trash(uri): 290 path = get_ local_path_from_uri(uri)291 path = get_path_from_uri(uri) 291 292 path = os.path.realpath(os.path.expanduser(path)) 292 293 if not os.path.exists(path): return False 293 294 #find the trash folder -
src/source/local.py
167 167 added = [] 168 168 db_uris = set(ListenDB.get_all_uris()) 169 169 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 ] 171 171 last_estimated = estimated = 0 172 172 total_dirs = len(alldirs) 173 173 parsed_dirs = 0 -
src/source/ipod.py
142 142 track.remember_playback_position = 0x00 143 143 track.flag4 = 0x00 # Show Title/Album/Artist on the 'Now Playing' page 144 144 145 filename = str(vfs.get_ local_path_from_uri(tmp_uri))145 filename = str(vfs.get_path_from_uri(tmp_uri)) 146 146 147 147 for ltag,itag in IPOD_IDS.iteritems(): 148 148 real_itag = itag.replace("@","").replace("#","") … … 205 205 self.__current_transcode.stop() 206 206 self.__current_transcode = None 207 207 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)) 209 209 except: pass 210 210 self.cond.acquire() 211 211 self.loginfo("%d song deleted from queue",len(self.__transfer_list)) -
src/source/podcast.py
360 360 if self.debug: print "I:PodcastDownloadJob:Start download:",uri 361 361 proxy = discover_http_proxy() 362 362 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") 364 364 info = handle_read.info() 365 365 366 366 try: totalsize = int(info.getheader("content-length"))
