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


Python Track.artist方法代码示例

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


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

示例1: get_track

# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import artist [as 别名]
    def get_track(provider_id):
        t = Track()
        try:
            ######MediaNet######
            # reqUrl = 'http://ie-api.mndigital.com?method=track.get&format=json&'\
            #     + urllib.urlencode({'mnetid': provider_id})\
            #     + '&ApiKey=%s' % MusicProvider._mnDigitalIntegrationAPIKey
            reqUrl = "http://itunes.apple.com/lookup?" + urllib.urlencode({"id": provider_id})

            # track_json = common.get_json(reqUrl)["Track"]
            track_json = common.get_json(reqUrl)["results"][0]

            t.provider_id = provider_id
            t.length_seconds = 0
            t.url = ""

            # t.artist = track_json["Artist"]["Name"]
            # t.title = track_json["Title"]
            # t.length_friendly = track_json["Duration"]
            # t.album = track_json["Album"]["Title"]
            # t.art_url = track_json["Album"]["Images"]["Album150x150"]

            t.artist = track_json["artistName"]
            t.title = track_json["trackName"]
            t.length_friendly = ""
            t.album = track_json["collectionName"]
            t.art_url = track_json["artworkUrl100"]

        except Exception:
            pass
        return t
开发者ID:chrisclark,项目名称:msfm,代码行数:33,代码来源:musicProvider.py

示例2: create_track_from_uri

# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import artist [as 别名]
    def create_track_from_uri(self, uri):
        if 'youtube' not in uri:
            return None
            
        m = re.search('http://www.youtube.com/get_video.video_id=(.*?)&t=(.*)',uri)

        client = gdata.youtube.service.YouTubeService()
        client.ssl = False

        entry = client.GetYouTubeVideoEntry(video_id=m.group(1))
        logging.debug("Created track from uri %s in youtubesource", uri)
        #PrintEntryDetails(entry)
        swfuri = entry.GetSwfUrl()

        video_id = m.group(1)
        t = m.group(2)

        track = Track(uri)
        track.title = entry.media.title.text
        track.artist = "YOUTUBE VIDEO"
        track.album = entry.media.category[0].text
        #FIXME add search for author on album?
        track.album_uri = None
        track.duration = int(entry.media.duration.seconds)*1000

        return track     
开发者ID:estock,项目名称:dogvibes,代码行数:28,代码来源:youtubesource.py

示例3: create_track_from_uri

# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import artist [as 别名]
    def create_track_from_uri(self, uri):
        uri = SpotifySource.strip_protocol(uri)
        if uri == None:
            return None
        url = "http://ws.spotify.com/lookup/1/?uri=" + uri

        try:
            e = ET.parse(urllib.urlopen(url))
        except Exception as e:
            return None

        ns = "http://www.spotify.com/ns/music/1"

        if 'album' in uri:
            title = ""
            artist = e.find('.//{%s}artist/{%s}name' % (ns, ns)).text
            album = e.find('.//{%s}name' % ns).text
            duration = 0
            album_uri = uri
        else:
            title = e.find('.//{%s}name' % ns).text
            artist = e.find('.//{%s}artist/{%s}name' % (ns, ns)).text
            album = e.find('.//{%s}album/{%s}name' % (ns, ns)).text
            duration = int(float(e.find('.//{%s}length' % ns).text) * 1000)
            album_uri = "spotify://" + e.find('.//{%s}album' % ns).attrib['href']

        track = Track("spotify://"+uri)
        track.title = title
        track.artist = artist
        track.album = album
        track.album_uri = album_uri
        track.duration = duration

        return track
开发者ID:popdevelop,项目名称:dogvibes_old_svn_master,代码行数:36,代码来源:spotifysource.py

示例4: create_track_from_uri

# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import artist [as 别名]
    def create_track_from_uri(self, uri):
        if 'asx' not in uri:
            return None

        logging.debug("Created track from uri %s in srradiosource", uri)
        u = urllib.urlopen(uri)
        str = re.search('\"mms:.+\"', u.read())

        u = open("sr.xml") 
        tree = ET.parse(u)
        u.close()

        track = Track(str.group(0)[1:-1])

        for e in tree.findall('channel'):
            for k in e.findall('streamingurl'):
                for s in k.findall('url'):
                    if uri in s.text:
                        track.title = e.get('name')

        track.artist = "SR RADIOTRACK"
        track.album = "SR RADIOTRACK"
        track.album_uri = None
        track.duration = 1

        return track     
开发者ID:estock,项目名称:dogvibes,代码行数:28,代码来源:srradiosource.py

示例5: create_tracks_from_album

# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import artist [as 别名]
 def create_tracks_from_album(self, album):
     tracks = []
     for track in album['tracks']:
         tmptrack = Track(track['uri'])
         tmptrack.title = track['title']
         tmptrack.artist = track['artist']
         tmptrack.album = album['name']
         tmptrack.album_uri = album['uri']
         tmptrack.duration = track['duration']
         tracks.append(tmptrack)
     return tracks
开发者ID:popdevelop,项目名称:dogvibes_old_svn_master,代码行数:13,代码来源:spotifysource.py

示例6: index

# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import artist [as 别名]
 def index(self, path):
     for top, dirnames, filenames in os.walk(path):
         for filename in filenames:
             if filename.endswith('.mp3'):
                 full_path = os.path.join(top, filename);
                 f = tagpy.FileRef(full_path)
                 t = Track("file://" + full_path)
                 t.title = f.tag().title
                 t.artist = f.tag().artist
                 t.album = f.tag().album
                 a = f.audioProperties()
                 t.duration = a.length * 1000 # to msec
                 self.add_track(t)
开发者ID:popdevelop,项目名称:dogvibes_old,代码行数:15,代码来源:collection.py

示例7: indexFromFile

# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import artist [as 别名]
	def indexFromFile(self):
		self.file = open(os.getcwd() + '/options/index.txt', 'r')
		path = None
		line = self.file.readline()
		while line != '':
			code = line[0:2]
			if code == "NP":
				path = line[2:-1]
				line = self.file.readline()
			t = Track()
			t.path = path + "/" + line[0:-1]
			t.artist = self.file.readline()[0:-1]
			t.title = self.file.readline()[0:-1]
			t.album = self.file.readline()[0:-1]
			self.tracks.append(t)
			self.gui.addTrack(t)
			line = self.file.readline()
			
		self.file.close()
		self.gui.loading_finished()	
开发者ID:nemo13,项目名称:PySic,代码行数:22,代码来源:indexer.py

示例8: create_track_from_uri

# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import artist [as 别名]
    def create_track_from_uri(self, uri):
        url = "http://ws.spotify.com/lookup/1/?uri=" + uri

        try:
            e = ET.parse(urllib.urlopen(url))
        except Exception as e:
            return None

        ns = "http://www.spotify.com/ns/music/1"

        title = e.find('.//{%s}name' % ns).text
        artist = e.find('.//{%s}artist/{%s}name' % (ns, ns)).text
        album = e.find('.//{%s}album/{%s}name' % (ns, ns)).text
        duration = int(float(e.find('.//{%s}length' % ns).text) * 1000)

        track = Track("spotify://"+uri)
        track.title = title
        track.artist = artist
        track.album = album
        track.duration = duration

        return track
开发者ID:popdevelop,项目名称:dogvibes_old,代码行数:24,代码来源:spotifysource.py


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