当前位置: 首页>>代码示例>>Python>>正文


Python Link.from_artist方法代码示例

本文整理汇总了Python中spotify.Link.from_artist方法的典型用法代码示例。如果您正苦于以下问题:Python Link.from_artist方法的具体用法?Python Link.from_artist怎么用?Python Link.from_artist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在spotify.Link的用法示例。


在下文中一共展示了Link.from_artist方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: to_mopidy_artist

# 需要导入模块: from spotify import Link [as 别名]
# 或者: from spotify.Link import from_artist [as 别名]
 def to_mopidy_artist(cls, spotify_artist):
     if not spotify_artist.is_loaded():
         return Artist(name=u'[loading...]')
     return Artist(
         uri=str(Link.from_artist(spotify_artist)),
         name=spotify_artist.name()
     )
开发者ID:Amli,项目名称:mopidy,代码行数:9,代码来源:translator.py

示例2: add_artist_link

# 需要导入模块: from spotify import Link [as 别名]
# 或者: from spotify.Link import from_artist [as 别名]
    def add_artist_link(self, artist, source):
        """
        Add an artist link to the queue.
        """
        link = str(Link.from_artist(artist))

        if not self._items:
            self._items = [ ]

            with open('queue.json', 'r') as fp:
                self._items = json.load(fp)

        found = False

        for item in self._items:
            if item['link'] == link:
                found = True
                break

        if not found:
            while not artist.is_loaded():
                time.sleep(0.1)

            print 'Adding %s' % artist.name()

            self._items.append({
                    'name':   artist.name(),
                    'link':   link,
                    'source': source,
                    })

            with open('queue.json', 'w') as fp:
                json.dump(self._items, fp, indent=2)

        return True
开发者ID:poelzi,项目名称:spotify-ripper,代码行数:37,代码来源:json_queue.py

示例3: do_search

# 需要导入模块: from spotify import Link [as 别名]
# 或者: from spotify.Link import from_artist [as 别名]
	def do_search(self, line):
		if not line:
			if self.results is False:
				print "No search is in progress"
			elif self.results is None:
				print "Searching is in progress"
			else:
				print "Artists:"
				for a in self.results.artists():
					print "	", Link.from_artist(a), a.name()
				print "Albums:"
				for a in self.results.albums():
					print "	", Link.from_album(a), a.name()
				print "Tracks:"
				for a in self.results.tracks():
					print "	", Link.from_track(a, 0), a.name()
				print self.results.total_tracks() - \
						len(self.results.tracks()), "Tracks not shown"
		else:
			line = line.decode('utf-8')
			self.results = None
			def search_finished(results, userdata):
				print "\nSearch results received"
				self.results = results
				self.print_search_results()
			self.jukebox.search(line, search_finished)
开发者ID:bertspaan,项目名称:wekkie,代码行数:28,代码来源:wekkie_player.py

示例4: action_search

# 需要导入模块: from spotify import Link [as 别名]
# 或者: from spotify.Link import from_artist [as 别名]
 def action_search(self, line):
     if not line:
         if self.results is False:
             print "No search is in progress"
             return False
         elif self.results is None:
             print "Searching is in progress"
         else:
             print "Artists:"
             for a in self.results.artists():
                 print "    ", Link.from_artist(a), a.name()
             print "Albums:"
             for a in self.results.albums():
                 print "    ", Link.from_album(a), a.name()
             print "Tracks:"
             for a in self.results.tracks():
                 print "    ", Link.from_track(a, 0), a.name()
             print self.results.total_tracks() - len(self.results.tracks()), "Tracks not shown"
             self.results = False
     else:
         self.results = None
         def _(results, userdata):
             print "\nSearch results received"
             self.results = results
         self.search(line, _)
开发者ID:olekenneth,项目名称:chains,代码行数:27,代码来源:__init__.py

示例5: to_mopidy_artist

# 需要导入模块: from spotify import Link [as 别名]
# 或者: from spotify.Link import from_artist [as 别名]
def to_mopidy_artist(spotify_artist):
    if spotify_artist is None:
        return
    uri = str(Link.from_artist(spotify_artist))
    if not spotify_artist.is_loaded():
        return Artist(uri=uri, name='[loading...]')
    return Artist(uri=uri, name=spotify_artist.name())
开发者ID:AndreaCrotti,项目名称:mopidy,代码行数:9,代码来源:translator.py

示例6: add_artist_to_directory

# 需要导入模块: from spotify import Link [as 别名]
# 或者: from spotify.Link import from_artist [as 别名]
 def add_artist_to_directory(self, artist, directory):
     artist_uri = str(Link.from_artist(artist))
     directory.add(
         DirectoryObject(
             key = Callback(self.get_artist_albums, uri = artist_uri),
             title = artist.name().decode("utf-8"),
             thumb = R("placeholder-artist.png")
         )
     )
开发者ID:jarlebh,项目名称:Spotify.bundle,代码行数:11,代码来源:plugin.py

示例7: print_search_results

# 需要导入模块: from spotify import Link [as 别名]
# 或者: from spotify.Link import from_artist [as 别名]
	def print_search_results(self):
		print "Artists:"
		for a in self.results.artists():
			print "	", Link.from_artist(a), a.name()
		print "Albums:"
		for a in self.results.albums():
			print "	", Link.from_album(a), a.name()
		print "Tracks:"
		for a in self.results.tracks():
			print "	", Link.from_track(a, 0), a.name()
		print self.results.total_tracks() - len(self.results.tracks()), \
			"Tracks not shown"
开发者ID:bertspaan,项目名称:wekkie,代码行数:14,代码来源:wekkie_player.py

示例8: browse_artist

# 需要导入模块: from spotify import Link [as 别名]
# 或者: from spotify.Link import from_artist [as 别名]
    def browse_artist(self, artist, callback):
        ''' Browse an artist, invoking the callback when done

        :param artist:         An artist instance to browse.
        :param callback:       A callback to invoke when the album is loaded.
                               Should take the browser as a single parameter.
        '''
        link = Link.from_artist(artist)
        def callback_wrapper(browser, userdata):
            self.log("Artist browse complete: %s" % Link.from_artist(artist))
            callback(browser)
        self.log("Browse artist: %s" % link)
        browser = ArtistBrowser(artist, "no_tracks", callback_wrapper)
        return browser
开发者ID:fldc,项目名称:Spotify.bundle,代码行数:16,代码来源:client.py

示例9: callback_wrapper

# 需要导入模块: from spotify import Link [as 别名]
# 或者: from spotify.Link import from_artist [as 别名]
 def callback_wrapper(browser, userdata):
     self.log("Artist browse complete: %s" % Link.from_artist(artist))
     callback(browser)
开发者ID:fldc,项目名称:Spotify.bundle,代码行数:5,代码来源:client.py

示例10: _to_mopidy_artist

# 需要导入模块: from spotify import Link [as 别名]
# 或者: from spotify.Link import from_artist [as 别名]
 def _to_mopidy_artist(self, spotify_artist):
     return Artist(
         uri=str(Link.from_artist(spotify_artist)),
         name=spotify_artist.name().decode(ENCODING),
     )
开发者ID:mortenberg80,项目名称:mopidy,代码行数:7,代码来源:libspotify.py


注:本文中的spotify.Link.from_artist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。