コード例 #1
0
    def run(self):
        # wait for container
        container_loaded.wait()
        container_loaded.clear()

        # create track iterator
        link = Link.from_string(sys.argv[3])
        if link.type() == Link.LINK_TRACK:
            track = link.as_track()
            itrack = iter([track])
        elif link.type() == Link.LINK_PLAYLIST:
            playlist = link.as_playlist()
            print('loading playlist ...')
            while not playlist.is_loaded():
                time.sleep(0.1)
            print('done')
            itrack = iter(playlist)

        # ripping loop
        session = self.ripper.session
        for track in itrack:

                self.ripper.load_track(track)

                rip_init(session, track)

                self.ripper.play()

                end_of_track.wait()
                end_of_track.clear() # TODO check if necessary

                rip_terminate(session, track)
                rip_id3(session, track)

        self.ripper.disconnect()
コード例 #2
0
	def run(self):
		container_loaded.wait()
		container_loaded.clear()

		link = Link.from_string(sys.argv[3])
		if link.type() == Link.LINK_TRACK:
			track = link.as_track()
			itrack = iter([track])
		elif link.type() == Link.LINK_PLAYLIST:
			playlist = link.as_playlist()
			print('loading playlist...')
			while not playlist.is_loaded():
				time.sleep(0.1)
			print('done')
			itrack = iter(playlist)

		session = self.ripper.session
		for track in itrack:

			self.ripper.load_track(track)

			rip_init(session, track)

			self.ripper.play()

			end_of_track.wait()
			end_of_track.clear()

			rip_terminate(session, track)
			rip_id3(session, track)

		self.ripper.disconnect()
コード例 #3
0
    def run(self):
        global skipping
        # wait for container
        container_loaded.wait()
        container_loaded.clear()

        # create track iterator
        link = Link.from_string(sys.argv[3])
        playlist_dir = ""
        if link.type() == Link.LINK_TRACK:
            track = link.as_track()
            itrack = iter([track])
        elif link.type() == Link.LINK_PLAYLIST:
            playlist = link.as_playlist()
            playlist_dir = playlist.name() + "/"
            print('loading playlist "' + playlist.name() + '"...')
            while not playlist.is_loaded():
                time.sleep(0.1)
            print('done')
            itrack = iter(playlist)

        # ripping loop
        session = self.ripper.session
        i = 1
        for track in itrack:
                self.ripper.load_track(track)

                rip_init(session, track, playlist_dir, i)

                if not skipping:
                    self.ripper.play()
                    end_of_track.wait()
                    end_of_track.clear() # TODO check if necessary
                    rip_terminate(session, track)
                    rip_id3(session, track)
                else:
                    rip_terminate(session, track)
                    skipping = False
                print('\n\n')
                i = i + 1

        self.ripper.disconnect()
コード例 #4
0
ファイル: jbripper.py プロジェクト: madrover/spotifyripper
    def run(self):
        # wait for container
        container_loaded.wait()
        container_loaded.clear()

        # create track iterator
        link = Link.from_string(args.url[0])
        if link.type() == Link.LINK_TRACK:
            track = link.as_track()
            itrack = iter([track])
        elif link.type() == Link.LINK_PLAYLIST:
            playlist = link.as_playlist()
            print('loading playlist ...')
            while not playlist.is_loaded():
                time.sleep(0.1)
            print('done')
            itrack = iter(playlist)

        # ripping loop
        session = self.ripper.session
        count = 0
        for track in itrack:
                count += 1
                print "Track " + str(count)
                if track.availability() != 1:
                    print 'Skipping. Track not available'
                else:
                    self.ripper.load_track(track)

                    if not library_track_exists(track):

                        rip_init(session, track)

                        self.ripper.play()

                        end_of_track.wait()
                        end_of_track.clear() # TODO check if necessary

                        rip_terminate(session, track)
                        rip_id3(session, track)

        self.ripper.disconnect()
コード例 #5
0
    def run(self):
        # wait for container
        container_loaded.wait()
        container_loaded.clear()

        # create track iterator
        link = Link.from_string(sys.argv[3])
        if link.type() == Link.LINK_PLAYLIST:
            playlist = link.as_playlist()
            print('Loading the playlist: ' + str(playlist))
            while not playlist.is_loaded():
                time.sleep(0.1)
            print('done')
            session = self.ripper.session
            name = str(playlist)
            print("name: " + name)
            for track in iter(playlist):
                self.ripper.load_track(track)
                rip_init(session, track, name)
                rip_id3(session, track, name)

            self.ripper.disconnect()
コード例 #6
0
ファイル: applefy.py プロジェクト: ryanb93/pyApplefy
    def run(self):
        # wait for container
        container_loaded.wait()
        container_loaded.clear()

        # create track iterator
        link = Link.from_string(sys.argv[3])
        if link.type() == Link.LINK_PLAYLIST:
            playlist = link.as_playlist()
            print('Loading the playlist: ' + str(playlist))
            while not playlist.is_loaded():
                time.sleep(0.1)
            print('done')
            session = self.ripper.session
            name = str(playlist)
            print("name: " + name)
            for track in iter(playlist):
                self.ripper.load_track(track)
                rip_init(session, track, name)
                rip_id3(session, track, name)

            self.ripper.disconnect()
コード例 #7
0
ファイル: jbripper.py プロジェクト: l3iggs/spotifyripper
    def run(self):
        # wait for container
        container_loaded.wait()
        container_loaded.clear()

        # output dir
        outputdir = os.getcwd()
        if args.outputdir != None:
            outputdir = os.path.normpath(os.path.realpath(args.outputdir[0]))

        # create track iterator
        link = Link.from_string(args.url[0])
        if link.type() == Link.LINK_TRACK:
            track = link.as_track()
            itrack = iter([track])
        elif link.type() == Link.LINK_PLAYLIST:
            playlist = link.as_playlist()
            print('loading playlist ...')
            while not playlist.is_loaded():
                time.sleep(0.1)
            print('done')
            itrack = iter(playlist)

        # ripping loop
        session = self.ripper.session
        count = 0
        for track in itrack:
                count += 1
                # if the track is not loaded, track.availability is not ready
                self.ripper.load_track(track)
                if interrupt.isSet():
                    break
                while not track.is_loaded():
                    time.sleep(0.1)
                if track.availability() != 1:
                    print('Skipping. Track not available')
                else:
                    #self.ripper.load_track(track)
                    exists = library_track_exists(track, outputdir)
                    if exists:
                        print("Skipping. Track found at " + exists)
                    else:
                        try:
                            rip_init(session, track, outputdir)

                            self.ripper.play()

                            end_of_track.wait()
                            end_of_track.clear() # TODO check if necessary

                            rip_terminate(session, track)
                            if interrupt.isSet():
                                rip_delete(track, outputdir)
                                break
                            rip_id3(session, track, outputdir)
                        except (KeyboardInterrupt, SystemExit):
                            raise
                        except Exception as inst:
                            if not args.ignoreerrors:
                                raise
                            print("Unexpected error: ", type(inst))
                            print(inst)
                            print("Skipping to next track, if in playlist")

        self.ripper.disconnect()