예제 #1
0
 def get_common_beans(self):
     beans = []
     cue = self.parse()
     if not self.is_cue_valid():
         return []
     for i, track  in enumerate(cue.tracks):
         bean = FModel(text=track.performer + " - " + track.title, path=track.path)
         bean.artist = track.performer
         bean.tracknumber = i + 1
         bean.title = track.title
         bean.album = self.cue_file.title
         bean.name = bean.text
         bean.start_sec = track.get_start_time_sec()
         bean.duration_sec = track.duration
         bean.time = convert_seconds_to_text(track.duration)
         bean.is_file = True
         try:
             bean.info = foobnix.util.id3_util.normalized_info(get_mutagen_audio(track.path).info, bean)
         except Exception, e:
             logging.warn(str(e) + " " + bean.path)
             bean.info = ""
                                    
         if not bean.title or not bean.artist:
             bean = udpate_id3(bean)
         
         beans.append(bean)
예제 #2
0
    def find_tracks_by_url(self, url):
        logging.debug("Search By URL")

        index = url.rfind("#")
        if index > 0:
            url = url[:index]
        index = url.find("id=")
        if index < 0:
            return None

        id = url[index + 3:]
        id = int(id)
        if id > 0:
            results = self.get_result('audio.get', "uid=" + str(id))
        else:
            results = self.get_result('audio.get', "gid=" + str(abs(id)))

        childs = []
        for line in results:
            bean = FModel(line['artist'] + ' - ' + line['title'])
            bean.aritst = line['artist']
            bean.title = line['title']
            bean.time = convert_seconds_to_text(line['duration'])
            bean.path = line['url']
            childs.append(bean)

        return childs
예제 #3
0
 def find_tracks_by_url(self, url):
     logging.debug("Search By URL")
     
     index = url.rfind("#")
     if index > 0:
         url = url[:index]
     index = url.find("id=")
     if index < 0:
         return None
     
     id = url[index + 3:]
     id = int(id)
     if id > 0:
         results = self.get_result('audio.get', "uid="+str(id))
     else:
         results = self.get_result('audio.get', "gid="+str(abs(id)))
         
     childs = []
     for line in results:
         bean = FModel(line['artist'] + ' - ' + line['title'])
         bean.aritst = line['artist']
         bean.title = line['title']
         bean.time = convert_seconds_to_text(line['duration'])
         bean.path = line['url']
         childs.append(bean)
          
    
     return childs 
예제 #4
0
 def get_common_beans(self):
     beans = []
     cue = self.parse()
     if not self.is_cue_valid():
         return []
     for i, track  in enumerate(cue.tracks):
         bean = FModel(text=track.performer + " - " + track.title, path=track.path)
         bean.artist = track.performer
         bean.tracknumber = i + 1
         bean.title = track.title
         bean.album = self.cue_file.title
         bean.name = bean.text
         bean.start_sec = track.get_start_time_sec()
         bean.duration_sec = track.duration
         bean.time = convert_seconds_to_text(track.duration)
         bean.is_file = True
         try:
             bean.info = foobnix.util.id3_util.normalized_info(get_mutagen_audio(track.path).info, bean)
         except Exception, e:
             logging.warn(str(e) + " " + bean.path)
             bean.info = ""
                                    
         if not bean.title or not bean.artist:
             bean = udpate_id3(bean)
         
         beans.append(bean)
예제 #5
0
    def find_tracks_by_query(self, query):
        def post():
            self.find_tracks_by_query(self, query)
            
        if self.is_show_authorization(post):
            return 
        
        logging.info("start search songs " + query)
        query = urllib.quote(query.encode("utf-8"))
        
        list = self.get_result("audio.search", "q=" + query)
        childs = []
        
        if not list:
            return childs

        for line in list[1:]:                      
            bean = FModel(line['artist'] + ' - ' + line['title'])
            bean.aritst = line['artist']
            bean.title = line['title']
            bean.time = convert_seconds_to_text(line['duration'])
            bean.path = line['url']
            childs.append(bean)
             
        return childs
예제 #6
0
 def task():
     old_iters = self.get_child_iters_by_parent(self.model, self.get_iter_from_bean(parent));
     childs = []
     for line in self.controls.vk_service.api.get('audio.get',uid=parent.user_id):
         bean = FModel(line['artist']+' - '+line['title'])
         bean.aritst = line['artist']
         bean.title = line['title']
         bean.time = convert_seconds_to_text(line['duration'])
         bean.path = line['url']
         childs.append(bean)
                 
     update_parent_for_beans(childs, parent)
     
     self.append_all(childs)            
     gobject.idle_add(self.remove_iters,old_iters)        
예제 #7
0
 def task():
     for line in self.controls.vk_service.get_result('audio.get',"uid="+parent.user_id):
         logging.debug(line);
         bean = FModel(line['artist']+' - '+line['title'])
         
         bean.aritst = line['artist']
         bean.title = line['title']
         bean.time = convert_seconds_to_text(line['duration'])
         bean.path = line['url']
         bean.is_file = True
         
         row = self.get_row_from_bean(bean);
         self.model.append(p_iter, row)
     
     for rem in old_iters:
         self.model.remove(rem)   
예제 #8
0
        def task():
            for line in self.controls.vk_service.get_result(
                    'audio.get', "uid=" + parent.user_id):
                logging.debug(line)
                bean = FModel(line['artist'] + ' - ' + line['title'])

                bean.aritst = line['artist']
                bean.title = line['title']
                bean.time = convert_seconds_to_text(line['duration'])
                bean.path = line['url']
                bean.is_file = True

                row = self.get_row_from_bean(bean)
                self.model.append(p_iter, row)

            for rem in old_iters:
                self.model.remove(rem)
예제 #9
0
        def task():
            old_iters = self.get_child_iters_by_parent(
                self.model, self.get_iter_from_bean(parent))
            childs = []
            for line in self.controls.vk_service.api.get('audio.get',
                                                         uid=parent.user_id):
                bean = FModel(line['artist'] + ' - ' + line['title'])
                bean.aritst = line['artist']
                bean.title = line['title']
                bean.time = convert_seconds_to_text(line['duration'])
                bean.path = line['url']
                childs.append(bean)

            update_parent_for_beans(childs, parent)

            self.append_all(childs)
            gobject.idle_add(self.remove_iters, old_iters)
예제 #10
0
파일: cue_reader.py 프로젝트: Lomir/foobnix
 def get_common_beans(self):
     beans = []
     cue = self.parse()
     if not self.is_cue_valid():
         return []
     for i, track  in enumerate(cue.tracks):
         bean = FModel(text=track.performer + " - " + track.title, path=track.path)
         bean.artist = track.performer
         bean.tracknumber = i + 1
         bean.title = track.title
         bean.name = bean.text
         bean.start_sec = track.get_start_time_sec()
         bean.duration_sec = track.duration
         bean.time = convert_seconds_to_text(track.duration)
         bean.is_file = True
         beans.append(bean)
     
     return beans
예제 #11
0
    def find_tracks_by_query(self, query):
        if self.is_show_authorization():
            return

        logging.info("start search songs " + query)
        query = urllib.quote(query.encode("utf-8"))

        list = self.get_result("audio.search", "q=" + query)
        childs = []

        if not list:
            return childs

        for line in list[1:]:
            bean = FModel(line['artist'] + ' - ' + line['title'])
            bean.aritst = line['artist']
            bean.title = line['title']
            bean.time = convert_seconds_to_text(line['duration'])
            bean.path = line['url']
            childs.append(bean)

        return childs
예제 #12
0
 def find_tracks_by_query(self, query):
     if not self.is_connected():
         return []
     logging.info("start search songs" + query)
     page = self.search(query)
     if not page:
         return []
      
     results = self.api.get('audio.search',q=query, count=50)
         
     childs = []
     
     for i, line in enumerate(results):
         if i ==0:
             continue
         
         bean = FModel(line['artist']+' - '+line['title'])
         bean.aritst = line['artist']
         bean.title = line['title']
         bean.time = convert_seconds_to_text(line['duration'])
         bean.path = line['url']
         childs.append(bean)
          
     return childs
예제 #13
0
    def find_tracks_by_query(self, query):
        if not self.is_connected():
            return []
        logging.info("start search songs" + query)
        page = self.search(query)
        if not page:
            return []

        results = self.api.get('audio.search', q=query, count=50)

        childs = []

        for i, line in enumerate(results):
            if i == 0:
                continue

            bean = FModel(line['artist'] + ' - ' + line['title'])
            bean.aritst = line['artist']
            bean.title = line['title']
            bean.time = convert_seconds_to_text(line['duration'])
            bean.path = line['url']
            childs.append(bean)

        return childs