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


Python PlaylistTrack.album方法代码示例

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


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

示例1: save

# 需要导入模块: from playlists.models import PlaylistTrack [as 别名]
# 或者: from playlists.models.PlaylistTrack import album [as 别名]
    def save(self):
        if not self.current_user:
            raise ValueError("Cannot save() without a current_user")

        playlist_track = PlaylistTrack(
                            playlist=self.playlist,
                            selector=self.current_user)

        if self.cleaned_data['artist_key']:
            playlist_track.artist = Artist.get(self.cleaned_data['artist_key'])
        else:
            playlist_track.freeform_artist_name = self.cleaned_data['artist']
        if self.cleaned_data['song_key']:
            playlist_track.track = Track.get(self.cleaned_data['song_key'])
        else:
            playlist_track.freeform_track_title = self.cleaned_data['song']
        if self.cleaned_data['album_key']:
            playlist_track.album = Album.get(self.cleaned_data['album_key'])
        elif self.cleaned_data['album']:
            playlist_track.freeform_album_title = self.cleaned_data['album']
        if self.cleaned_data['label']:
            playlist_track.freeform_label = self.cleaned_data['label']
        if self.cleaned_data['song_notes']:
            playlist_track.notes = self.cleaned_data['song_notes']
        if self.cleaned_data['is_heavy_rotation']:
            playlist_track.categories.append('heavy_rotation')
        if self.cleaned_data['is_light_rotation']:
            playlist_track.categories.append('light_rotation')
        if self.cleaned_data['is_local_current']:
            playlist_track.categories.append('local_current')
        if self.cleaned_data['is_local_classic']:
            playlist_track.categories.append('local_classic')
        AutoRetry(playlist_track).save()

        return playlist_track
开发者ID:kumar303,项目名称:chirpradio,代码行数:37,代码来源:forms.py

示例2: save

# 需要导入模块: from playlists.models import PlaylistTrack [as 别名]
# 或者: from playlists.models.PlaylistTrack import album [as 别名]
    def save(self):
        if not self.current_user:
            raise ValueError("Cannot save() without a current_user")

        playlist_track = PlaylistTrack(
                            playlist=self.playlist,
                            selector=self.current_user)

        if self.cleaned_data['artist_key']:
            playlist_track.artist = Artist.get(self.cleaned_data['artist_key'])
        else:
            playlist_track.freeform_artist_name = self.cleaned_data['artist']
        if self.cleaned_data['song_key']:
            playlist_track.track = Track.get(self.cleaned_data['song_key'])
        else:
            playlist_track.freeform_track_title = self.cleaned_data['song']
        if self.cleaned_data['album_key']:
            playlist_track.album = Album.get(self.cleaned_data['album_key'])
        elif self.cleaned_data['album']:
            playlist_track.freeform_album_title = self.cleaned_data['album']
        if self.cleaned_data['label']:
            playlist_track.freeform_label = self.cleaned_data['label']
        if self.cleaned_data['song_notes']:
            playlist_track.notes = self.cleaned_data['song_notes']
        if self.cleaned_data['is_heavy_rotation']:
            playlist_track.categories.append('heavy_rotation')
        if self.cleaned_data['is_light_rotation']:
            playlist_track.categories.append('light_rotation')
        if self.cleaned_data['is_local_current']:
            playlist_track.categories.append('local_current')
        if self.cleaned_data['is_local_classic']:
            playlist_track.categories.append('local_classic')
        AutoRetry(playlist_track).save()

        trk = playlist_track
        memcache.set('playlist.last_track', {
            'artist_name': trk.artist_name,
            'track_title': trk.track_title,
            'album_title_display': trk.album_title_display,
            'label_display': trk.label_display,
            'notes': trk.notes,
            'key': str(trk.key()),
            'categories': list(trk.categories),
            'selector_key': str(trk.selector.key()),
            'established_display': trk.established.timetuple()[0:7]
        }, 30)

        return playlist_track
开发者ID:BubbleTouchSoftware,项目名称:chirpradio,代码行数:50,代码来源:forms.py


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