def _item_info_for(self, item): info = dict( item_source=self, source_type='sharing', feed_id = item.feed_id, feed_name = None, feed_url = None, state = u'saved', release_date = item.get_release_date(), size = item.size, duration = item.duration, resume_time = 0, permalink = item.permalink, commentslink = item.comments_link, payment_link = item.payment_link, has_shareable_url = bool(item.url), can_be_saved = False, pending_manual_dl = False, pending_auto_dl = False, expiration_date = None, item_viewed = True, downloaded = True, is_external = False, video_watched = True, video_path = item.get_filename(), thumbnail = item.get_thumbnail(), thumbnail_url = item.thumbnail_url or u'', file_format = item.file_format, license = item.license, file_url = item.url or u'', is_container_item = False, is_file_item = False, is_playable = True, children = [], file_type = item.file_type, subtitle_encoding = item.subtitle_encoding, seeding_status = None, media_type_checked = True, mime_type = item.enclosure_type, artist = item.artist, auto_rating = None, date_added = item.get_creation_time(), last_played = item.get_creation_time(), download_info = None, device = None, remote = True, leechers = None, seeders = None, up_rate = None, down_rate = None, up_total = None, down_total = None, up_down_ratio = 0, play_count=0, skip_count=0, host=item.host, port=item.port, is_playing=False) info.update(item.get_iteminfo_metadata()) return messages.ItemInfo(item.id, **info)
def _item_info_for(self, item): info = dict(item_source=self, source_type='sharing', feed_id=item.feed_id, feed_name=None, feed_url=None, state=u'saved', release_date=item.get_release_date(), size=item.size, duration=item.duration, resume_time=0, permalink=item.permalink, commentslink=item.comments_link, payment_link=item.payment_link, has_shareable_url=bool(item.url), can_be_saved=False, pending_manual_dl=False, pending_auto_dl=False, expiration_date=None, item_viewed=True, downloaded=True, is_external=False, video_watched=True, video_path=item.get_filename(), thumbnail=item.get_thumbnail(), thumbnail_url=item.thumbnail_url or u'', file_format=item.file_format, license=item.license, file_url=item.url or u'', is_container_item=False, is_file_item=False, is_playable=True, children=[], file_type=item.file_type, subtitle_encoding=item.subtitle_encoding, seeding_status=None, media_type_checked=True, mime_type=item.enclosure_type, artist=item.artist, auto_rating=None, date_added=item.get_creation_time(), last_played=item.get_creation_time(), download_info=None, device=None, remote=True, leechers=None, seeders=None, up_rate=None, down_rate=None, up_total=None, down_total=None, up_down_ratio=0, play_count=0, skip_count=0, host=item.host, port=item.port, is_playing=False) info.update(item.get_iteminfo_metadata()) return messages.ItemInfo(item.id, **info)
def _item_info_for(item): info = { 'feed_id': item.feed_id, 'feed_name': item.get_source(), 'feed_url': item.get_feed_url(), 'state': item.get_state(), 'release_date': item.get_release_date(), 'size': item.get_size(), 'duration': item.get_duration_value(), 'resume_time': item.resumeTime, 'permalink': item.get_link(), 'commentslink': item.get_comments_link(), 'payment_link': item.get_payment_link(), 'has_shareable_url': item.has_shareable_url(), 'can_be_saved': item.show_save_button(), 'pending_manual_dl': item.is_pending_manual_download(), 'pending_auto_dl': item.is_pending_auto_download(), 'item_viewed': item.get_viewed(), 'downloaded': item.is_downloaded(), 'is_external': item.is_external(), 'video_watched': item.get_seen(), 'video_path': item.get_filename(), 'thumbnail': item.get_thumbnail(), 'thumbnail_url': item.get_thumbnail_url(), 'file_format': item.get_format(), 'license': item.get_license(), 'file_url': item.get_url(), 'is_container_item': item.isContainerItem, 'is_file_item': item.is_file_item, 'is_playable': item.is_playable(), 'file_type': item.file_type, 'subtitle_encoding': item.subtitle_encoding, 'media_type_checked': item.media_type_checked, 'seeding_status': item.torrent_seeding_status(), 'mime_type': item.enclosure_type, 'date_added': item.get_creation_time(), 'last_played': item.get_watched_time(), 'last_watched': item.lastWatched, 'downloaded_time': item.downloadedTime, 'children': [], 'expiration_date': None, 'download_info': None, 'leechers': None, 'seeders': None, 'up_rate': None, 'down_rate': None, 'up_total': None, 'down_total': None, 'up_down_ratio': 0.0, 'remote': False, 'device': None, 'source_type': 'database', 'play_count': item.play_count, 'skip_count': item.skip_count, 'auto_rating': item.get_auto_rating(), 'is_playing': item.is_playing(), } info.update(item.get_iteminfo_metadata()) if item.isContainerItem: info['children'] = [ DatabaseItemSource._item_info_for(i) for i in item.get_children() ] if not item.keep and not item.is_external(): info['expiration_date'] = item.get_expiration_time() if item.downloader: info['download_info'] = messages.DownloadInfo(item.downloader) elif info['state'] == 'downloading': info['download_info'] = messages.PendingDownloadInfo() ## Torrent-specific stuff if item.looks_like_torrent() and hasattr(item.downloader, 'status'): status = item.downloader.status if item.is_transferring(): # gettorrentdetails only info['leechers'] = status.get('leechers', 0) info['seeders'] = status.get('seeders', 0) info['connections'] = status.get('connections', 0) info['up_rate'] = status.get('upRate', 0) info['down_rate'] = status.get('rate', 0) # gettorrentdetailsfinished & gettorrentdetails info['up_total'] = status.get('uploaded', 0) info['down_total'] = status.get('currentSize', 0) if info['down_total'] > 0: info['up_down_ratio'] = (float(info['up_total']) / info['down_total']) return messages.ItemInfo(item.id, **info)
def _item_info_for(item): info = { 'feed_id': item.feed_id, 'feed_name': item.get_source(), 'feed_url': item.get_feed_url(), 'state': item.get_state(), 'release_date': item.get_release_date(), 'size': item.get_size(), 'duration': item.get_duration_value(), 'resume_time': item.resumeTime, 'permalink': item.get_link(), 'commentslink': item.get_comments_link(), 'payment_link': item.get_payment_link(), 'has_shareable_url': item.has_shareable_url(), 'can_be_saved': item.show_save_button(), 'pending_manual_dl': item.is_pending_manual_download(), 'pending_auto_dl': item.is_pending_auto_download(), 'item_viewed': item.get_viewed(), 'downloaded': item.is_downloaded(), 'is_external': item.is_external(), 'video_watched': item.get_seen(), 'video_path': item.get_filename(), 'thumbnail': item.get_thumbnail(), 'thumbnail_url': item.get_thumbnail_url(), 'file_format': item.get_format(), 'license': item.get_license(), 'file_url': item.get_url(), 'is_container_item': item.isContainerItem, 'is_playable': item.is_playable(), 'file_type': item.file_type, 'subtitle_encoding': item.subtitle_encoding, 'media_type_checked': item.media_type_checked, 'seeding_status': item.torrent_seeding_status(), 'mime_type': item.enclosure_type, 'date_added': item.get_creation_time(), 'last_played': item.get_watched_time(), 'last_watched': item.lastWatched, 'downloaded_time': item.downloadedTime, 'children': [], 'expiration_date': None, 'download_info': None, 'leechers': None, 'seeders': None, 'up_rate': None, 'down_rate': None, 'up_total': None, 'down_total': None, 'up_down_ratio': 0.0, 'remote': False, 'device': None, 'source_type': 'database', 'play_count': item.play_count, 'skip_count': item.skip_count, 'auto_rating': item.get_auto_rating(), 'is_playing': item.is_playing(), } info.update(item.get_iteminfo_metadata()) if item.isContainerItem: info['children'] = [DatabaseItemSource._item_info_for(i) for i in item.get_children()] if not item.keep and not item.is_external(): info['expiration_date'] = item.get_expiration_time() if item.downloader: info['download_info'] = messages.DownloadInfo(item.downloader) elif info['state'] == 'downloading': info['download_info'] = messages.PendingDownloadInfo() ## Torrent-specific stuff if item.looks_like_torrent() and hasattr(item.downloader, 'status'): status = item.downloader.status if item.is_transferring(): # gettorrentdetails only info['leechers'] = status.get('leechers', 0) info['seeders'] = status.get('seeders', 0) info['connections'] = status.get('connections', 0) info['up_rate'] = status.get('upRate', 0) info['down_rate'] = status.get('rate', 0) # gettorrentdetailsfinished & gettorrentdetails info['up_total'] = status.get('uploaded', 0) info['down_total'] = status.get('currentSize', 0) if info['down_total'] > 0: info['up_down_ratio'] = (float(info['up_total']) / info['down_total']) return messages.ItemInfo(item.id, **info)