def switch_locale(self, locale_type):
     '''
     Change the locale
     '''
     locale.setlocale(locale.LC_ALL, '')
     locale.bindtextdomain(locale_type, RB.locale_dir())
     locale.textdomain(locale_type)
     gettext.bindtextdomain(locale_type, RB.locale_dir())
     gettext.textdomain(locale_type)
     gettext.install(locale_type)
Example #2
0
 def switch_locale(self, locale_type):
     """
     Change the locale
     """
     locale.setlocale(locale.LC_ALL, '')
     locale.bindtextdomain(locale_type, RB.locale_dir())
     locale.textdomain(locale_type)
     gettext.bindtextdomain(locale_type, RB.locale_dir())
     gettext.textdomain(locale_type)
     gettext.install(locale_type)
Example #3
0
import sys
import xml
import urllib.parse, urllib.request
import threading
import zipfile

import rb
from gi.repository import RB
from gi.repository import GObject, Gtk, Gdk, Gio, GLib

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(),
Example #4
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from gi.repository import RB, Gio, Gtk, GdkPixbuf, GObject, Peas, PeasGtk, WebKit
import rb #"Loader" heler class
from xml.dom import minidom #xml parser
import urllib2 #search line escaping, simple https requests
from html_decode import decode_htmlentities #results decoding

import gettext
gettext.install('rhythmbox', RB.locale_dir())

#entry type for results. not saving on disk
class VKEntryType(RB.RhythmDBEntryType):
	def __init__(self):
		RB.RhythmDBEntryType.__init__(self, name="vk-entry-type", save_to_disk=False)
	def can_sync_metadata(self, entry):
		return False
	def do_sync_metadata(self, entry, changes):
		return

class VKRhythmbox(GObject.Object, Peas.Activatable):
	__gtype_name = 'VKRhythmboxPlugin'
	object = GObject.property(type=GObject.GObject)

	def __init__(self):
Example #5
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.

import rb
import gi
from gi.repository import Gio, GLib, GObject, Peas
from gi.repository import RB

import gettext
gettext.install('rhythmbox', RB.locale_dir(), unicode=True)

NORMAL_SONG_ARTIST = 'artist'
NORMAL_SONG_TITLE = 'title'
NORMAL_SONG_ALBUM = 'album'
STREAM_SONG_ARTIST = 'rb:stream-song-artist'
STREAM_SONG_TITLE = 'rb:stream-song-title'
STREAM_SONG_ALBUM = 'rb:stream-song-album'

PROPERTIES_IFACE_NAME = 'org.freedesktop.DBus.Properties'
MC5_BUS_NAME = 'org.freedesktop.Telepathy.MissionControl5'
MC5_AM_OBJ_PATH = '/org/freedesktop/Telepathy/AccountManager'
MC5_AM_IFACE_NAME = 'org.freedesktop.Telepathy.AccountManager'
MC5_ACCT_IFACE_NAME = 'org.freedesktop.Telepathy.Account'

PURPLE_BUS_NAME = 'im.pidgin.purple.PurpleService'
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.

import pylast
from gi.repository import GObject, Gio, Gtk, Peas, RB

import rb
import LastFMExtensionKeys as Keys
import LastFMExtensionUtils
from LastFMExtensionUtils import asynchronous_call as async, notify
from LastFMExtensionGui import ConfigDialog

import gettext
gettext.install('rhythmbox', RB.locale_dir(), unicode=True)

ui_str = """
<ui>
  <toolbar name="ToolBar">
    <placeholder name="PluginPlaceholder">
      <toolitem name="Loves" action="LoveTrack"/>
      <toolitem name="Ban" action="BanTrack"/>
    </placeholder>
  </toolbar>
</ui>
"""

LASTFM_ICON = 'img/as.png'
LOVE_ICON = 'img/love.png'
BAN_ICON = 'img/ban.png'
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.

import os.path
import rb3compat
import rb
from gi.repository import RB

import gettext

gettext.install("rhythmbox", RB.locale_dir())

ART_FOLDER = os.path.expanduser(os.path.join(RB.user_cache_dir(), "covers"))
USEFUL = os.path.exists(ART_FOLDER)


class OldCacheSearch(object):
    def __init__(self):
        pass

    def filename(self, album, artist, extension):
        artist = artist.replace("/", "-")
        album = album.replace("/", "-")
        return os.path.join(ART_FOLDER, "%s - %s.%s" % (artist, album, extension))

    def search(self, key, last_time, store, callback, *args):
Example #8
0
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""

import re
import gettext

from gi.repository import Gtk
from gi.repository import RB

from dialog import AddToPlaylistDialog

_ = gettext.gettext
APPNAME = "rhythmbox-baidu-music"
gettext.install(APPNAME, RB.locale_dir())
gettext.textdomain(APPNAME)


class SearchHandle(object):

    def __init__(self, builder, client, collect_source, temp_source, playlists):

        # the basic objects
        self.__collect_source = collect_source
        self.__temp_source = temp_source
        self.__client = client
        self.__builder = builder
        self.__playlists = playlists

        # the widgets