Example #1
0
def render_dir(path):
    return dick(
        cls = 'dir',
        links = [dick(
            link = path.replace(u'/bt', u'/a', 1),
            text = os.path.basename(path)
        )]
    )
    base = os.path.basename(path)
    path = path.replace(u'/bt', u'/a', 1)
    return u'<div><a href="{path}">{base}</a></div>'.format(**locals())
Example #2
0
File: av.py Project: ypcat/cowper
def aventertainments(page):
    url = "http://www.aventertainments.com/subdept_products.aspx?Dept_ID=29&SubDept_ID=45&languageID=2&SortBy=1&ShowWhichOne=0&Rows=1&WhichTitle=0&HowManyRecords=20&CountPage=%d" % page
    videos = []
    q = pq(url)
    for i in q('.main-content td table'):
        info = q(i).text()
        videos.append(dick(
            id = re.findall(ur'商品番号:\s*(\S+)', info)[0],
            date = re.findall(ur'発売日:\s*(\S+)', info)[0],
            link = q('h4 a', i).attr('href'),
            name = (re.findall(ur'女優名:\s*(\S+)', info) or [''])[0],
            title = q('h4', i).text(),
            cover = re.findall('imagefile=(http://.*?.jpg)', q(u'a:contains("ジャケット画像")', i).attr('onclick'))[0],
            search = re.findall(ur'商品番号:\s*(\S+)', info)[0].replace('-', ' '),
            rating = 0,
            find = []
        ))
    return url, videos
Example #3
0
def list_torrents(last_id=1e6, count=30, reverse=False):
    db = psycopg2.connect('')
    cur = db.cursor()
    if reverse:
        cur.execute('''SELECT COALESCE(t.video, -t.id) AS u,
                              json_agg(t), json_agg(v)
                       FROM torrent t LEFT OUTER JOIN video v ON t.video = v.id
                       GROUP BY u HAVING min(t.id) > %s
                       ORDER BY min(t.id) LIMIT %s''', [last_id, count])
    else:
        cur.execute('''SELECT COALESCE(t.video, -t.id) AS u,
                              json_agg(t), json_agg(v)
                       FROM torrent t LEFT OUTER JOIN video v ON t.video = v.id
                       GROUP BY u HAVING max(t.id) < %s
                       ORDER BY max(t.id) DESC LIMIT %s''', [last_id, count])
    rows = [dick(torrents=[dick(u) for u in t], video=dick(v[0] or {}))
            for _, t, v in cur]
    db.close()
    return rows
Example #4
0
File: av.py Project: ypcat/cowper
def mgs(series, page):
    url = u"http://jftsai.csie.org:5566/mgs/list/%s/%d" % (series, page)
    videos = []
    for i in rq(url).json():
        videos.append(dick(
            id = i['id'],
            date = '',
            link = "http://jftsai.csie.org:5566/mgs/video/%s" % i['id'],
            name = i['name'],
            title = i['title'],
            cover = "http://jftsai.csie.org:5566/mgs/cover/%s" % i['id'],
            search = i['id'].replace('-', ' '),
            rating = 0,
            find = []
        ))
    return url, videos
Example #5
0
def search(term):
    url = 'http://sukebei.nyaa.se/?page=search&cats=8_0&sort=2&term=' + term
    d = feedparser.parse(url.replace('search', 'rss', 1))
    results = [dick(
        name = e.title,
        link = e.id,
        torrent = e.link,
        published = '-'.join(str(i) for i in e.published_parsed[:3]),
        seed = e.summary.split()[0],
        size = e.summary.split(' - ')[1],
    ) for e in d.entries]
    return template('''<html>
        <head>
            <style>
                body { font-size: x-large; }
            </style>
            <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
            <script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
        </head>
        <body>
            <div class="container">
                <a href="{{url}}">Source</a>
                <table class="table">
                    <tr><th>Date</th><th style="width: 60%">Name</th><th>Torrent</th><th>Size</th><th>Seed</th></tr>
                    % for r in results:
                    <tr>
                        <td>{{r.published}}</td>
                        <td><a href="{{r.link}}">{{r.name}}</a></td>
                        <td>
                            <form class="form-inline" action="/api/torrent" method="post" role="form">
                                <div class="form-group">
                                    <a href="{{r.torrent}}" class="btn btn-sm btn-default glyphicon glyphicon-download-alt"></a>
                                    <a href="{{r.torrent}}&magnet=1" class="btn btn-sm btn-default glyphicon glyphicon-magnet"></a>
                                    <input type="hidden" name="url" value="{{r.torrent}}">
                                    <button type="submit" class="btn btn-sm btn-default glyphicon glyphicon-cloud-upload"></button>
                                </div>
                            </form>
                        </td>
                        <td>{{r.size}}</td>
                        <td>{{r.seed}}</td>
                    </tr>
                    % end
                </table>
            </div>
        </body>
    </html>''', results=results, url=url)
Example #6
0
File: av.py Project: ypcat/cowper
def _1pondo(page):
    url = "http://www.1pondo.tv/dyn/ren/movie_lists/list_newest_%d.json" % ((page - 1) * 50)
    videos = []
    for i in rq(url).json()['Rows']:
        videos.append(dick(
            #id = i['MovieID'] + '-1pon',
            id = i['MovieID'],
            date = i['Release'],
            link = 'http://www.1pondo.tv/movies/%s/' % i['MetaMovieID'],
            name = i['Actor'],
            title = i['Title'],
            cover = i['ThumbHigh'],
            search = i['MovieID'].replace('_', ' '),
            rating = 0,
            find = []#find = find(i['MovieID'] + '-1pon'),
        ))
    return url, videos
Example #7
0
File: av.py Project: ypcat/cowper
def tokyo_hot(page):
    url = "http://www.tokyo-hot.com/product/?page=%d" % page
    videos = []
    q = pq(url)
    for i in q('.detail'):
        videos.append(dick(
            id = q('img', i).attr('alt'),
            date = '',
            link = 'http://www.tokyo-hot.com' + q('a', i).attr('href'),
            name = q('.actor', i).text().split()[0],
            title = q('.title', i).text(),
            cover = q('img', i).attr('src').replace('220x124', '820x462'),
            search = q('img', i).attr('alt'),
            rating = 0,
            find = []#find = find(q('img', i).attr('alt')),
        ))
    return url, videos
Example #8
0
File: av.py Project: ypcat/cowper
def muramura(page):
    url = u"http://www.muramura.tv/listpages/0_%d.html" % page
    videos = []
    q = pq(url, encoding='euc-jp')
    for i in q('.entry'):
        label = q('.figure a', i).attr('href').split('/')[-2]
        videos.append(dick(
            id = label,
            date = '',
            link = q('.figure a', i).attr('href'),
            name = '',
            title = q('h3:first', i).text(),
            cover = q('.figure img').attr('src'),
            search = 'muramura ' + label.replace('-', ' '),
            rating = 0,
            find = []
        ))
    return url, videos
Example #9
0
File: av.py Project: ypcat/cowper
def _10musume(page):
    url = "http://www.10musume.com/listpages/1_%d.html" % page
    videos = []
    q = pq(url, encoding='euc-jp')
    for i in q('.emph2 dl'):
        label = q('a', i).attr('href').split('/')[-2]
        videos.append(dick(
            id = label,
            date = q('dd:first span', i).text(),
            link = q('a', i).attr('href').split('?')[0],
            name = q('dd:first a', i).text().split()[0],
            title = q('dd:eq(1)', i).text(),
            cover = q('img', i).attr('src').replace('list1', 'str'),
            search = '10musume ' + label.replace('-', ' '),
            rating = 0,
            find = []
        ))
    return url, videos
Example #10
0
File: av.py Project: ypcat/cowper
def heydouga(page):
    url = "http://www.heydouga.com/listpages/all_%d.html" % page
    videos = []
    q = pq(url)
    for i in q('.listItem'):
        label = '-'.join(q('a', i).attr('href').split('/')[2:4])
        videos.append(dick(
            id = label,
            date = '',
            link = 'http://www.heydouga.com' + q('a', i).attr('href'),
            name = q('.actor', i).text(),
            title = q('.listTitle', i).text(),
            cover = q('.listItem img', i).attr('onerror').split("'")[1],
            search = 'heydouga ' + label.replace('-', ' '),
            rating = 0,
            find = []
        ))
    return url, videos
Example #11
0
File: av.py Project: ypcat/cowper
def heyzo(page):
    url = "http://www.heyzo.com/listpages/all_%d.html" % page
    videos = []
    q = pq(url, encoding='utf-8')
    for i in q('.movie'):
        videos.append(dick(
            #id = 'heyzo-' + q('a', i).attr('href').split('/')[2],
            id = q('a', i).attr('href').split('/')[2],
            date = q('.release', i).text().split()[-1],
            link = 'http://www.heyzo.com' + q('a', i).attr('href'),
            name = q('.actor', i).text(),
            title = q('.movietitle', i).text(),
            cover = "http://www.heyzo.com/contents/3000/%s/images/player_thumbnail.jpg" % q('a', i).attr('href').split('/')[2],
            search = 'heyzo ' + q('a', i).attr('href').split('/')[2],
            rating = float(re.findall(r'\d+', q('.review-value img', i).attr('style'))[0]) / 28,
            find = []#find = find('heyzo-' + q('a', i).attr('href').split('/')[2]),
        ))
    return url, videos
Example #12
0
File: av.py Project: ypcat/cowper
def caribbeancom(page):
    url = "http://www.caribbeancom.com/listpages/all%d.htm" % page
    videos = []
    q = pq(url)
    for i in q('div[itemtype="http://schema.org/VideoObject"]'):
        videos.append(dick(
            #id = q('a', i).attr('href').split('/')[2] + '-carib',
            id = q('a', i).attr('href').split('/')[2],
            date = q('.movie-date', i).text(),
            link = 'http://www.caribbeancom.com' + q('a', i).attr('href'),
            name = q('.movie-actor', i).text(),
            title = q('.movie-title', i).text(),
            cover = 'http://www.caribbeancom.com' + q('a', i).attr('href').replace('index.html', 'images/l_l.jpg'),
            search = q('a', i).attr('href').split('/')[2].replace('-', ' '),
            rating = 0,
            find = []#find = find(q('a', i).attr('href').split('/')[2] + '-carib'),
        ))
    return url, videos
Example #13
0
File: av.py Project: ypcat/cowper
def dmm(page):
    url = "http://www.dmm.co.jp/digital/videoa/-/list/=/limit=30/sort=date/page=%d/" % page
    videos = []
    q = pq(url)
    for i in q('.tmb'):
        link = re.sub('\?.*', '', q('a', i).attr('href'))
        label, num = dmm_label(link)
        videos.append(dick(
            #id = "%s-%03d" % (label.upper(), int(num)),
            id = "%s-%d" % (label.upper(), int(num)),
            date = '',
            link = link,
            name = q(i).next().text().replace('----', ''),
            title = q('img', i).attr('alt'),
            cover = q('img', i).attr('src').replace('pt.jpg', 'pl.jpg'),
            search = "%s %d" % (label.upper(), int(num)),
            rating = float(q(i).parent().find('.rate').text().replace('-', '0')),
            find = []#find = find("%s*%d" % (label.upper(), int(num))),
        ))
    return url, videos
Example #14
0
def render_file(path):
    base = os.path.basename(path)
    dirname = os.path.dirname(path)
    size = human(os.stat(path).st_size)
    path = urllib.pathname2url(path.encode('utf8'))
    vlcbase = "vlc://192.168.1.103"
    if base.endswith(ITYPES):
        video_path = get_video(path)
        link = vlcbase + video_path if video_path else path
        res = dick(cls='file image', links=[dick(link=link, img=path)])
    elif base.endswith(VTYPES):
        link = vlcbase + path
        playlist = "vlc://ypcat.csie.org/api/playlist/{dirname}?reverse=1&start={path}".format(**locals())
        res = dick(
            cls = 'file video',
            size = size,
            links = [
                dick(link=path, text=base),
                dick(cls='btn btn-sm btn-warning glyphicon glyphicon-play', link=link),
                dick(cls='btn btn-sm btn-info glyphicon glyphicon-forward', link=playlist),
                dick(cls='delete btn btn-sm btn-danger glyphicon glyphicon-remove', data=path)
            ]
        )
    elif base.endswith(ZTYPES):
        link = "/api/read2/" + path
        res = dick(
            cls = 'file zip',
            size = size,
            links = [
                dick(link=path, text=base),
                dick(link=link, text='read')
            ]
        )
    else:
        res = dick(cls='file', size=size, links=[dick(link=path, text=base)])
    if archive_dir(path):
        res.links += [dick(cls='archive', text='archive', data=path)]
    return res