Example #1
0
def _():
    edb.connect()
    idb.connect()
    items = []

    for path in edb.fetchall():
        drama = drama_detail(path)
        item = ListItem(drama['title'])
        item.addContextMenuItems([
            (localized_str(33100),
             'RunPlugin(plugin://plugin.video.dramacool/recently-viewed?delete='
             + path + ')'),
            (localized_str(33101),
             'RunPlugin(plugin://plugin.video.dramacool/recently-viewed?delete=%)'
             )
        ])
        item.setArt({'poster': drama.pop('poster')})
        item.setInfo('video', drama)
        items.append((plugin.url_for(path), item, True))

    edb.close()
    idb.close()
    xbmcplugin.setContent(plugin.handle, 'videos')
    xbmcplugin.addDirectoryItems(plugin.handle, items, len(items))
    xbmcplugin.endOfDirectory(plugin.handle)
Example #2
0
def _():
    charlist, statuslist, yearlist = request.parse(plugin.path,
                                                   'FilterListParser')
    genrelist = [
        'Action', 'Adventure', 'Comedy', 'Crime', 'Drama', 'Fantasy', 'Horror',
        'Mystery', 'Romance', 'Sci-fi', 'Thriller'
    ]
    dialog = FilterDialog(charlist, genrelist, statuslist, yearlist)
    dialog.doModal()

    if not dialog.cancelled:
        dramalist = request.parse(plugin.path,
                                  'CharGenreStatusYearDramaListParser',
                                  **dialog.result())
        idb.connect()
        items = []

        for (path, poster, info) in idb.fetchall(dramalist):
            item = ListItem(info['title'])
            item.setArt({'poster': poster})
            item.setInfo('video', info)
            items.append((url_for(path), item, True))

        idb.close()
        show(items, 'tvshows', True)
Example #3
0
def _():
    response = request(plugin.pathquery)
    document = BeautifulSoup(response.text, 'html.parser').find(
        'ul', {'class': ['list-episode-item', 'list-star']})
    items = []

    if document is not None:
        if plugin.path == '/list-star.html' or (
                'type' in plugin.query and 'stars' in plugin.query['type']):
            for li in document.find_all('li', recursive=False):
                plot = li.find('ul')
                item = ListItem(li.find('img').attrs['alt'])
                item.setArt({'poster': li.find('img').attrs['data-original']})
                item.setInfo('video',
                             {'plot': '' if plot is None else plot.text})
                items.append(
                    (plugin.url_for(li.find('a').attrs['href']), item, True))
        elif plugin.path in ('/most-popular-drama', '/search'):
            idb.connect()

            for a in document.find_all('a'):
                path = a.attrs['href']
                drama = drama_detail(path)
                item = ListItem(drama['title'])
                item.setArt({'poster': drama.pop('poster')})
                item.setInfo('video', drama)
                items.append((plugin.url_for(path), item, True))

            idb.close()
        else:
            for a in document.find_all('a'):
                item = ListItem(u'[{}] {} {}'.format(
                    a.find('span', {
                        'class': 'type'
                    }).text,
                    a.find('h3').text,
                    a.find('span', {
                        'class': 'ep'
                    }).text))
                item.setArt({'poster': a.find('img').attrs['data-original']})
                item.setInfo('video', {})
                item.setProperty('IsPlayable', 'true')
                items.append((plugin.url_for(a.attrs['href']), item, False))

        document = document.find_next_sibling()

        if document is not None:
            for li in document.find_all('li', {'class': ['next', 'previous']}):
                item = ListItem(
                    localized_str(33600 if li.text == 'Next >' else 33601))
                items.append(
                    (plugin.url_for(plugin.path + li.find('a').attrs['href']),
                     item, True))
                print('   -----  ' +
                      plugin.url_for(plugin.path + li.find('a').attrs['href']))

    xbmcplugin.setContent(plugin.handle, 'videos')
    xbmcplugin.addDirectoryItems(plugin.handle, items, len(items))
    xbmcplugin.endOfDirectory(plugin.handle)
Example #4
0
def create_database():
    idb.connect()

    for path in ['/drama-list']:
        response = request(path)
        document = BeautifulSoup(response.content, 'html.parser')

        for li in document.find_all('li', {'class': 'filter-item'}):
            drama_detail(li.find('a').attrs['href'])

    idb.close()
Example #5
0
def _():
    idb.connect()
    items = []

    for (path, poster, info) in idb.fetchall(
            request.parse(plugin.path, 'StarDramaListParser')):
        item = ListItem(info['title'])
        item.setArt({'poster': poster})
        item.setInfo('video', info)
        items.append((url_for(path), item, True))

    idb.close()
    show(items, 'tvshows', True)
Example #6
0
def _():
    items = []
    (dramalist, paginationlist) = request.parse(plugin.full_path,
                                                'DramaPaginationListParser')
    idb.connect()

    for path in dramalist:
        (poster, info) = idb.fetchone(path)
        item = ListItem(info['title'])
        item.setArt({'poster': poster})
        item.setInfo('video', info)
        items.append((url_for(path), item, True))

    idb.close()
    append_pagination(items, paginationlist)
    show(items, 'tvshows')
Example #7
0
def _():
    (recentlylist,
     paginationlist) = request.parse(plugin.full_path,
                                     'RecentlyPaginationListParser')
    idb.connect()
    items = []

    for (path, poster, title) in recentlylist:
        item = ListItem(title)
        item.setArt({'poster': poster})
        item.setInfo('video', idb.fetchplot(poster))
        item.setProperty('IsPlayable', 'true')
        items.append((url_for(path), item, False))

    idb.close()
    append_pagination(items, paginationlist)
    show(items, 'tvshows')
Example #8
0
def _():
    edb.connect()
    idb.connect()
    items = []

    for path in edb.fetchall():
        (poster, info) = idb.fetchone(path)
        item = ListItem(info['title'])
        item.addContextMenuItems([(_addon.getLocalizedString(33100),
                                   f'RunPlugin({plugin.url}?delete={path})'),
                                  (_addon.getLocalizedString(33101),
                                   f'RunPlugin({plugin.url}?delete=%)')])
        item.setArt({'poster': poster})
        item.setInfo('video', info)
        items.append((url_for(path), item, True))

    edb.close()
    idb.close()
    show(items, 'tvshows')
Example #9
0
def _():
    response = request(plugin.path)
    document = BeautifulSoup(response.text, 'html.parser')
    idb.connect()
    items = []

    for a in document.find('ul', {'class': 'list-episode-item'}).find_all('a'):
        path = a.attrs['href']
        drama = drama_detail(path)
        item = ListItem(drama['title'])
        item.setArt({'poster': drama.pop('poster')})
        item.setInfo('video', drama)
        items.append((plugin.url_for(path), item, True))

    idb.close()
    xbmcplugin.setContent(plugin.handle, 'videos')
    xbmcplugin.addDirectoryItems(plugin.handle, items, len(items))
    xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_TITLE)
    xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
    xbmcplugin.endOfDirectory(plugin.handle)
Example #10
0
def _(select_id, select_value, path):
    idb.connect()
    response = request(path)
    document = BeautifulSoup(response.text, 'html.parser')
    items = []

    if select_id == 'char':
        select_value = chr(int(select_value))

        for div in document.find_all('div', {'class': 'list-content'}):
            if div.find('h4').text == select_value:
                for a in div.find('ul', {
                        'class': 'filter-char'
                }).find_all('a'):
                    path = a.attrs['href']
                    drama = drama_detail(path)
                    item = ListItem(drama['title'])
                    item.setArt({'poster': drama.pop('poster')})
                    item.setInfo('video', drama)
                    items.append((plugin.url_for(path), item, True))

                break
    else:
        for li in document.find_all(
                'li', {'class': '{}_{}'.format(select_id, select_value)}):
            path = li.find('a').attrs['href']
            drama = drama_detail(path)
            item = ListItem(drama['title'])
            item.setArt({'poster': drama.pop('poster')})
            item.setInfo('video', drama)
            items.append((plugin.url_for(path), item, True))

    idb.close()
    xbmcplugin.setContent(plugin.handle, 'videos')
    xbmcplugin.addDirectoryItems(plugin.handle, items, len(items))
    xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_TITLE)
    xbmcplugin.addSortMethod(plugin.handle, xbmcplugin.SORT_METHOD_VIDEO_YEAR)
    xbmcplugin.endOfDirectory(plugin.handle)