Example #1
0
    def __init__(self,
                 path,
                 username=None,
                 password=None,
                 true_file_size=False,
                 verbose=0,
                 scan_library=True):
        Operations.__init__(self)
        self.artist_dir = re.compile('^/artists/(?P<artist>[^/]+)$')
        self.artist_album_dir = re.compile(
            '^/artists/(?P<artist>[^/]+)/(?P<year>[0-9]{4}) - (?P<album>[^/]+)$'
        )
        self.artist_album_track = re.compile(
            '^/artists/(?P<artist>[^/]+)/(?P<year>[0-9]{4}) - (?P<album>[^/]+)/(?P<track>[^/]+\.mp3)$'
        )
        self.artist_album_image = re.compile(
            '^/artists/(?P<artist>[^/]+)/(?P<year>[0-9]{4}) - (?P<album>[^/]+)/(?P<image>[^/]+\.jpg)$'
        )

        self.__open_files = {}  # path -> urllib2_obj

        # login to google music and parse the tracks:
        self.library = MusicLibrary(username,
                                    password,
                                    true_file_size=true_file_size,
                                    verbose=verbose,
                                    scan=scan_library)
        log.info("Filesystem ready : %s" % path)
Example #2
0
    def __init__(self, path, username=None, password=None,
                 true_file_size=False, verbose=0, scan_library=True,
                 lowercase=True):
        Operations.__init__(self)
        self.artist_dir = re.compile('^/artists/(?P<artist>[^/]+)$')
        self.artist_album_dir = re.compile(
            '^/artists/(?P<artist>[^/]+)/(?P<year>[0-9]{4}) - (?P<album>[^/]+)$')
        self.artist_album_track = re.compile(
            '^/artists/(?P<artist>[^/]+)/(?P<year>[0-9]{4}) - (?P<album>[^/]+)/(?P<track>[^/]+\.mp3)$')
        self.artist_album_image = re.compile(
            '^/artists/(?P<artist>[^/]+)/(?P<year>[0-9]{4}) - (?P<album>[^/]+)/(?P<image>[^/]+\.jpg)$')
        self.playlist_dir = re.compile('^/playlists/(?P<playlist>[^/]+)$')
        self.playlist_track = re.compile(
            '^/playlists/(?P<playlist>[^/]+)/(?P<track>[^/]+\.mp3)$')

        self.__open_files = {} # path -> urllib2_obj

        # Define transformation based on whether lowercase filenames will be used or not
        if lowercase:
            self.transform = lambda x: x.lower()
        else:
            self.transform = lambda x: x

        # Login to Google Play Music and parse the tracks:
        self.library = MusicLibrary(username, password,
                                    true_file_size=true_file_size, verbose=verbose, scan=scan_library)
        log.info("Filesystem ready : %s" % path)
Example #3
0
    def __init__(self, path, username=None, password=None,
                 true_file_size=False, verbose=0, scan_library=True,
                 lowercase=True):
        Operations.__init__(self)

        artist = '/artists/(?P<artist>[^/]+)'

        self.artist_dir = re.compile('^{artist}$'.format(
            artist=artist))
        self.artist_album_dir = re.compile('^{artist}/{album}$'.format(
            artist=artist, album=ALBUM_REGEX))
        self.artist_album_track = re.compile('^{artist}/{album}/{track}$'.format(
            artist=artist, album=ALBUM_REGEX, track=TRACK_REGEX))

        self.playlist_dir = re.compile('^/playlists/(?P<playlist>[^/]+)$')
        self.playlist_track = re.compile(
            '^/playlists/(?P<playlist>[^/]+)/(?P<track>[^/]+\.mp3)$')

        self.__open_files = {}  # path -> urllib2_obj
        self.__urls = {}        # path -> url
        self.__tags = {}        # fh -> (id3v1, id3v2)

        # Define transformation based on whether lowercase filenames will be used or not
        if lowercase:
            self.transform = lambda x: x.lower()
        else:
            self.transform = lambda x: x

        # Login to Google Play Music and parse the tracks:
        self.library = MusicLibrary(username, password,
                                    true_file_size=true_file_size, verbose=verbose, scan=scan_library)
        log.info("Filesystem ready : %s" % path)
Example #4
0
    def __init__(self,
                 path,
                 username=None,
                 password=None,
                 true_file_size=False,
                 verbose=0,
                 lowercase=True):
        Operations.__init__(self)

        artist = '/artists/(?P<artist>[^/]+)'

        self.artist_dir = re.compile('^{artist}$'.format(artist=artist))
        self.artist_album_dir = re.compile('^{artist}/{album}$'.format(
            artist=artist, album=ALBUM_REGEX))
        self.artist_album_track = re.compile(
            '^{artist}/{album}/{track}$'.format(artist=artist,
                                                album=ALBUM_REGEX,
                                                track=TRACK_REGEX))

        self.playlist_dir = re.compile('^/playlists/(?P<playlist>[^/]+)$')
        #self.playlist_track = re.compile('^/playlists/(?P<playlist>[^/]+)/(?P<track>[^/]+\.mp3)$')
        self.playlist_track = re.compile(
            '^/playlists/(?P<playlist>[^/]+)/(?P<track>(?P<number>[0-9]+) - (?P<title>.*)\.mp3)$'
        )

        self.__opened_tracks = {}  # path -> urllib2_obj

        # Login to Google Play Music and parse the tracks:
        self.library = MusicLibrary(username,
                                    password,
                                    true_file_size=true_file_size,
                                    verbose=verbose)
        log.info("Filesystem ready : %s" % path)
Example #5
0
    def __init__(self, path, username=None, password=None,
                 true_file_size=False, verbose=0, scan_library=True):
        Operations.__init__(self)
        self.artist_dir = re.compile('^/artists/(?P<artist>[^/]+)$')
        self.artist_album_dir = re.compile(
            '^/artists/(?P<artist>[^/]+)/(?P<year>[0-9]{4}) - (?P<album>[^/]+)$')
        self.artist_album_track = re.compile(
            '^/artists/(?P<artist>[^/]+)/(?P<year>[0-9]{4}) - (?P<album>[^/]+)/(?P<track>[^/]+\.mp3)$')
        self.artist_album_image = re.compile(
            '^/artists/(?P<artist>[^/]+)/(?P<year>[0-9]{4}) - (?P<album>[^/]+)/(?P<image>[^/]+\.jpg)$')

        self.__open_files = {} # path -> urllib2_obj

        # login to google music and parse the tracks:
        self.library = MusicLibrary(username, password,
                                    true_file_size=true_file_size, verbose=verbose, scan=scan_library)
        log.info("Filesystem ready : %s" % path)
Example #6
0
    def __init__(self,
                 path,
                 username=None,
                 password=None,
                 true_file_size=False,
                 verbose=0,
                 scan_library=True,
                 lowercase=True):
        Operations.__init__(self)

        artist = '/artists/(?P<artist>[^/]+)'

        self.artist_dir = re.compile('^{artist}$'.format(artist=artist))
        self.artist_album_dir = re.compile('^{artist}/{album}$'.format(
            artist=artist, album=ALBUM_REGEX))
        self.artist_album_track = re.compile(
            '^{artist}/{album}/{track}$'.format(artist=artist,
                                                album=ALBUM_REGEX,
                                                track=TRACK_REGEX))

        self.playlist_dir = re.compile('^/playlists/(?P<playlist>[^/]+)$')
        self.playlist_track = re.compile(
            '^/playlists/(?P<playlist>[^/]+)/(?P<track>[^/]+\.mp3)$')

        self.__open_files = {}  # path -> urllib2_obj
        self.__urls = {}  # path -> url
        self.__tags = {}  # fh -> (id3v1, id3v2)

        # Define transformation based on whether lowercase filenames will be used or not
        if lowercase:
            self.transform = lambda x: x.lower()
        else:
            self.transform = lambda x: x

        # Login to Google Play Music and parse the tracks:
        self.library = MusicLibrary(username,
                                    password,
                                    true_file_size=true_file_size,
                                    verbose=verbose,
                                    scan=scan_library)
        log.info("Filesystem ready : %s" % path)
Example #7
0
    def __init__ (self, path, username=None, password=None, true_file_size=False, verbose=0, lowercase=True, check=False): # TODO: lovercase

        self.library_path = path

        Operations.__init__(self)

        artist = '/artists/(?P<artist>[^/]+)'  # TODO: remove/move me

        self.artist_dir = re.compile('^{artist}$'.format(artist=artist))

        self.artist_album_dir = re.compile(
            '^{artist}/{album}$'.format(
                artist=artist, album=Album.ALBUM_REGEX
            )
        )

        self.artist_album_dir2 = re.compile(
            '^{artist}/{album}$'.format(
                artist=artist, album=Album.ALBUM_REGEX2
            )
        )
        self.artist_album_track = re.compile(
            '^{artist}/{album}/{track}$'.format(
                artist=artist, album=Album.ALBUM_REGEX, track=Track.TRACK_REGEX
            )
        )

        self.playlist_dir   = re.compile('^/playlists/(?P<playlist>[^/]+)$')
        #print(Playlist.PLAYLIST_REGEX)
        self.playlist_track = re.compile(Playlist.PLAYLIST_REGEX)
        #print(Track.TRACKS_REGEX)
        self.tracks_track   = re.compile(Track.TRACKS_REGEX)

        self.__opened_tracks = {}  # path -> urllib2_obj # TODO: make somth with it


        # Login to Google Play Music and parse the tracks:
        if(check):
            return
        self.library = MusicLibrary(username, password, gfs=self, true_file_size=true_file_size, verbose=verbose, GFS=self) #TODO: probably even make it out of initialization? and in the main do separately authorization and initialization of the library
        log.info("Filesystem ready : %s" % path)
Example #8
0
    def __init__(self,
                 path,
                 username=None,
                 password=None,
                 true_file_size=False,
                 verbose=0,
                 scan_library=True,
                 lowercase=True):
        Operations.__init__(self)
        self.artist_dir = re.compile('^/artists/(?P<artist>[^/]+)$')
        self.artist_album_dir = re.compile(
            '^/artists/(?P<artist>[^/]+)/(?P<year>[0-9]{4}) - (?P<album>[^/]+)$'
        )
        self.artist_album_track = re.compile(
            '^/artists/(?P<artist>[^/]+)/(?P<year>[0-9]{4}) - (?P<album>[^/]+)/(?P<track>[^/]+\.mp3)$'
        )
        self.artist_album_image = re.compile(
            '^/artists/(?P<artist>[^/]+)/(?P<year>[0-9]{4}) - (?P<album>[^/]+)/(?P<image>[^/]+\.jpg)$'
        )
        self.playlist_dir = re.compile('^/playlists/(?P<playlist>[^/]+)$')
        self.playlist_track = re.compile(
            '^/playlists/(?P<playlist>[^/]+)/(?P<track>[^/]+\.mp3)$')

        self.__open_files = {}  # path -> urllib2_obj

        # Define transformation based on whether lowercase filenames will be used or not
        if lowercase:
            self.transform = lambda x: x.lower()
        else:
            self.transform = lambda x: x

        # Login to Google Play Music and parse the tracks:
        self.library = MusicLibrary(username,
                                    password,
                                    true_file_size=true_file_size,
                                    verbose=verbose,
                                    scan=scan_library)
        log.info("Filesystem ready : %s" % path)
Example #9
0
    def __call__(self, op, *args):
        log.debug('-> %s %s', op, repr(args))
        try:
            ret = Operations.__call__(self, op, *args)
            log.debug('<- %s %s', op, repr(ret))
            return ret
        except FuseOSError as fuse_ex:
            # The lower-level code can log at a higher level if cares to
            log.debug('<- %s %d (%s)', op, fuse_ex.errno, fuse_ex.strerror)
            raise fuse_ex
        except BaseException as e:
            # For convenience, we let the lower-level code allow some
            # exceptions to bubble out. Process those now.
            fuse_ex, level = (None, None)
            try:
                (fuse_ex, level) = self.to_fuse_ex(e)
            except:
                log.fatal('<- %s failed to parse error. '
                          'Unmounting FS and crashing!',
                          op, exc_info=True)
                self.crash()

            if fuse_ex:
                log.log(level,
                        '<- %s %d (%s): %s: %s',
                        op, fuse_ex.errno, fuse_ex.strerror,
                        e.__class__.__name__, e.message or '-')
                raise fuse_ex
            else:
                # Crap, we didn't expect this kind of error.
                # Anything that made it out here is a programming error.
                # The wise choice is to dump core so we can debug post-mortem.
                log.fatal('<- %s resulted in an unrecoverable error. '
                          'Unmounting FS and crashing!',
                          op, exc_info=True)
                self.crash()
Example #10
0
    def __init__(self):
        Operations.__init__(self)

        self.__log = logging.getLogger().getChild('GD_VFS')
Example #11
0
    def __init__(self):
        Operations.__init__(self)

        self.__log = logging.getLogger().getChild('GD_VFS')
Example #12
0
 def __call__(self, op, path, *args):
     real_path = self._find_referent(path)
     logging.debug('calling %s with %s (%s) %s' % (op, path, real_path, str(args)))
     return Operations.__call__(self, op, real_path, *args)