Logo Search packages:      
Sourcecode: viridian version File versions  Download package

def AmpacheTools::AmpacheGUI::AmpacheGUI::download_song_clicked (   self,
  widget,
  song_id,
  show_panel = True 
)
The user clicked download song.

Definition at line 3144 of file AmpacheGUI.py.

                                                                       :
            """The user clicked download song."""
            # check to see if the downloads directory exists
            if not os.path.exists(self.downloads_directory):
                  self.create_dialog_alert("warn", _("The folder %s does not exist.  You can change the folder in Preferences.") % (self.downloads_directory), True)
                  return False
            if show_panel and self.show_downloads_checkbox.active == False:
                  self.side_panel.show()
                  self.downloads_window.show()
                  self.show_downloads_checkbox.set_active(True)
            song_url = self.ampache_conn.get_song_url(song_id)
            m = re.search('name=.*\.[a-zA-Z0-9]+', song_url)
            song_string = helperfunctions.convert_html_to_string(m.group(0).replace('name=/',''))
            full_file = os.path.join(self.downloads_directory, song_string)
            self.downloads_list_store.append([song_string, 0, full_file])
            iter1 = self.downloads_list_store.get_iter(len(self.downloads_list_store) - 1)
            thread.start_new_thread(self.download_song, (song_url, full_file, iter1))
            

Generated by  Doxygen 1.6.0   Back to index