def user_has_account(): session_file = os.path.join(RB.user_data_dir(), "audioscrobbler", "sessions") if os.path.exists(session_file) == False: return False sessions = ConfigParser.RawConfigParser() sessions.read(session_file) try: return (sessions.get('Last.fm', 'username') != "") except: return False
def enable_debugging(self, action, parameter, shell): pwd_path = os.path.join(RB.user_data_dir(), "rpdb2_password") msg = _( "After you press OK, Rhythmbox will wait until you connect to it with winpdb or rpdb2. If you have not set a debugger password in the file %s, it will use the default password ('rhythmbox')." ) % pwd_path dialog = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, Gtk.ButtonsType.OK_CANCEL, msg) if dialog.run() == Gtk.ResponseType.OK: password = "******" if os.path.exists(pwd_path): pwd_file = open(pwd_path) password = pwd_file.read().rstrip() pwd_file.close() def start_debugger(password): rpdb2.start_embedded_debugger(password) return False GLib.idle_add(start_debugger, password) dialog.destroy()
from DownloadAlbumHandler import DownloadAlbumHandler, MagnatuneDownloadError import MagnatuneAccount import gettext gettext.install('rhythmbox', RB.locale_dir()) magnatune_partner_id = "rhythmbox" # URIs magnatune_song_info_uri = "http://magnatune.com/info/song_info_xml.zip" magnatune_changed_uri = "http://magnatune.com/info/changed.txt" magnatune_buy_album_uri = "https://magnatune.com/buy/choose?" magnatune_api_download_uri = "http://%s:%[email protected]/buy/membership_free_dl_xml?" magnatune_in_progress_dir = Gio.file_new_for_path( RB.user_data_dir()).resolve_relative_path('magnatune') magnatune_cache_dir = Gio.file_new_for_path( RB.user_cache_dir()).resolve_relative_path('magnatune') magnatune_song_info = os.path.join(magnatune_cache_dir.get_path(), 'song_info.xml') magnatune_song_info_temp = os.path.join(magnatune_cache_dir.get_path(), 'song_info.zip.tmp') magnatune_changes = os.path.join(magnatune_cache_dir.get_path(), 'changed.txt') class MagnatuneSource(RB.BrowserSource): def __init__(self): RB.BrowserSource.__init__(self) self.hate = self
from TrackListHandler import TrackListHandler from DownloadAlbumHandler import DownloadAlbumHandler, MagnatuneDownloadError import MagnatuneAccount import gettext gettext.install('rhythmbox', RB.locale_dir()) magnatune_partner_id = "rhythmbox" # URIs magnatune_song_info_uri = "http://magnatune.com/info/song_info_xml.zip" magnatune_changed_uri = "http://magnatune.com/info/changed.txt" magnatune_buy_album_uri = "https://magnatune.com/buy/choose?" magnatune_api_download_uri = "http://%s:%[email protected]/buy/membership_free_dl_xml?" magnatune_in_progress_dir = Gio.file_new_for_path(RB.user_data_dir()).resolve_relative_path('magnatune') magnatune_cache_dir = Gio.file_new_for_path(RB.user_cache_dir()).resolve_relative_path('magnatune') magnatune_song_info = os.path.join(magnatune_cache_dir.get_path(), 'song_info.xml') magnatune_song_info_temp = os.path.join(magnatune_cache_dir.get_path(), 'song_info.zip.tmp') magnatune_changes = os.path.join(magnatune_cache_dir.get_path(), 'changed.txt') class MagnatuneSource(RB.BrowserSource): def __init__(self): RB.BrowserSource.__init__(self) self.hate = self self.__popup = None self.__settings = Gio.Settings.new("org.gnome.rhythmbox.plugins.magnatune") # source state
from TrackListHandler import TrackListHandler from DownloadAlbumHandler import DownloadAlbumHandler, MagnatuneDownloadError import MagnatuneAccount import gettext gettext.install('rhythmbox', RB.locale_dir()) magnatune_partner_id = "rhythmbox" # URIs magnatune_song_info_uri = "http://magnatune.com/info/song_info_xml.zip" magnatune_changed_uri = "http://magnatune.com/info/changed.txt" magnatune_buy_album_uri = "https://magnatune.com/buy/choose?" magnatune_api_download_uri = "http://%s:%[email protected]/buy/membership_free_dl_xml?" magnatune_in_progress_dir = Gio.file_new_for_path(RB.user_data_dir()).resolve_relative_path('magnatune') magnatune_cache_dir = Gio.file_new_for_path(RB.user_cache_dir()).resolve_relative_path('magnatune') magnatune_song_info = os.path.join(magnatune_cache_dir.get_path(), 'song_info.xml') magnatune_song_info_temp = os.path.join(magnatune_cache_dir.get_path(), 'song_info.zip.tmp') magnatune_changes = os.path.join(magnatune_cache_dir.get_path(), 'changed.txt') class MagnatuneSource(RB.BrowserSource): def __init__(self): RB.BrowserSource.__init__(self) self.hate = self self.__popup = None self.__settings = Gio.Settings("org.gnome.rhythmbox.plugins.magnatune") # source state
This is the module that interacts with the Rhythmbox plugin API. ''' from gi.repository import GObject, GLib, Gio, Gtk, RB, Peas import sys import random import gettext # Python 3 renamed anydbm to dbm if sys.version_info.major >= 3: import dbm else: import anydbm as dbm import time from . import generator __path__.insert(0, RB.user_data_dir()) # Allows user to override location from . import lf_site gettext.install('rhythmbox', RB.locale_dir()) ui_str = """ <ui> <menubar name="MenuBar"> <menu name="ToolsMenu" action="Tools"> <placeholder name="ToolsOps_5"> <menuitem name="leftfeet-generate" action="leftfeet-generate"/> </placeholder> </menu> </menubar> </ui> """