def extendPlaylistFromExistingPlaylist(language, pid, url, user, use_autotag = False) : log(obj = {'url': url, 'pid': pid}) filterOperation('editPlaylist', user) if not db.playlists.find_one({'_id': ObjectId(pid)}) : raise UserError('PLAYLIST_NOT_EXIST') cralwer, cleanURL = dispatch_playlist(url) if not cralwer : raise UserError('UNSUPPORTED_PLAYLIST_URL') task_id = _postPlaylistTask(cleanURL, pid, use_autotag, user, extend = True) return task_id
def extendPlaylistFromExistingPlaylist(pid, url, user, use_autotag=False): log(obj={'url': url, 'pid': pid}) filterOperation('editPlaylist', user) if not playlist_db.retrive_item(pid): raise UserError('PLAYLIST_NOT_EXIST') cralwer, cleanURL = dispatch_playlist(url) if not cralwer: raise UserError('UNSUPPORTED_PLAYLIST_URL') task_id = _postPlaylistTask(cleanURL, pid, use_autotag, user, extend=True) return task_id
def createPlaylistFromExistingPlaylist(language, url, user, use_autotag=False): log(obj={'url': url}) filterOperation('createPlaylistFromExistingPlaylist', user) cralwer, cleanURL = dispatch_playlist(url) if not cralwer: raise UserError('UNSUPPORTED_PLAYLIST_URL') new_playlist_id = createPlaylist(language, "创建中...", str(datetime.now()), '', user) log(obj={'pid': new_playlist_id}) task_id = _postPlaylistTask(cleanURL, new_playlist_id, use_autotag, user) return new_playlist_id, task_id