This page lists all encodes that are .avi files.
Publication Encode
45M Link
57M Link
80M Link
81M Link
85M Link
102M Link
107M Link
122M Link
125M Link
137M Link
143M Link
145M Link
155M Link
157M Link
164M Link
166M Link
168M Link
171M Link
174M Link
178M Link
182M Link
187M Link
189M Link
191M Link
195M Link
203M Link
217M Link
219M Link
221M Link
228M Link
236M Link
238M Link
242M Link
249M Link
250M Link
258M Link
260M Link
263M Link
265M Link
268M Link
271M Link
273M Link
275M Link
277M Link
278M Link
279M Link
281M Link
282M Link
290M Link
291M Link
292M Link
294M Link
298M Link
299M Link
300M Link
302M Link
304M Link
306M Link
311M Link
313M Link
315M Link
316M Link
317M Link
333M Link
338M Link
342M Link
343M Link
344M Link
346M Link
351M Link
352M Link
355M Link
358M Link
361M Link
365M Link
366M Link
372M Link
381M Link
391M Link
392M Link
401M Link
404M Link
405M Link
407M Link
409M Link
411M Link
417M Link
422M Link
424M Link
425M Link
430M Link
432M Link
434M Link
443M Link
452M Link
453M Link
460M Link
463M Link
467M Link
474M Link
475M Link
481M Link
484M Link
491M Link
494M Link
495M Link
496M Link
497M Link
514M Link
517M Link
525M Link
529M Link
531M Link
532M Link
537M Link
538M Link
541M Link
543M Link
544M Link
545M Link
554M Link
558M Link
560M Link
561M Link
563M Link
565M Link
568M Link
569M Link
576M Link
576M Link
577M Link
579M Link
584M Link
588M Link
589M Link
590M Link
591M Link
596M Link
598M Link
599M Link
600M Link
687M Link
691M Link
697M Link
698M Link
710M Link
719M Link
726M Link
731M Link
735M Link
737M Link
741M Link
744M Link
745M Link
748M Link
751M Link
754M Link
756M Link
760M Link
762M Link
763M Link
767M Link
770M Link
771M Link
772M Link
776M Link
780M Link
786M Link
789M Link
793M Link
803M Link
806M Link
812M Link
813M Link
817M Link
818M Link
821M Link
824M Link
825M Link
831M Link
832M Link
833M Link
837M Link
838M Link
840M Link
844M Link
847M Link
849M Link
852M Link
863M Link
866M Link
868M Link
872M Link
873M Link
877M Link
878M Link
884M Link
885M Link
889M Link
890M Link
892M Link
900M Link
909M Link
911M Link
917M Link
923M Link
928M Link
937M Link
944M Link
954M Link
955M Link
963M Link
964M Link
967M Link
968M Link
974M Link
978M Link
980M Link
982M Link
986M Link
987M Link
988M Link
989M Link
997M Link
998M Link
1000M Link
1001M Link
1003M Link
1014M Link
1018M Link
1021M Link
1027M Link
1031M Link
1036M Link
1037M Link
1038M Link
1039M Link
1044M Link
1052M Link
1053M Link
1059M Link
1062M Link
1064M Link
1067M Link
1070M Link
1073M Link
1075M Link
1077M Link
1083M Link
1087M Link
1088M Link
1089M Link
1092M Link
1098M Link
1100M Link
1106M Link
1110M Link
1111M Link
1112M Link
1114M Link
1115M Link
1131M Link
1139M Link
1143M Link
1148M Link
1148M Link
1150M Link
1155M Link
1164M Link
1165M Link
1166M Link
1176M Link
1194M Link
1197M Link
1216M Link

#! python3
# Generates a list of TASVideos publications that have AVI encodes.
# Written by Dacicus
#
# get https://tasvideos.org/api/v1/Publications/{id}

import json
import os
import requests
import sys
import time

requests_before_wait = 100
seconds_to_wait = 10

#############
# Functions #
#############

def verify_all_arguments_present(number_of_arguments):
    if number_of_arguments < 3:
        print('\nUsage: {} out start [end]'.format(sys.argv[0]))
        print('  out      File to which to write the list of links.')
        print('  start    Publication number at which to start (inclusive).')
        print('  end      Publication number at which to end (inclusive).  If omitted,\n           links will only be obtained for the start publication.')
        sys.exit()

def confirm_yesno(prompt):
    answer = input(prompt)
    while answer.lower() not in ['y', 'n']:
        print('ERROR: Answer must be y or n.\n')
        answer = input(prompt)
    return answer.lower()

def verify_out_filename(filename):
    if os.path.exists(filename):
        overwrite_file = confirm_yesno('WARNING: {} already exists.  Append (y/n)? '.format(filename))
        if overwrite_file == 'y':
            print('Links will be appended to {}\n'.format(filename))
            return filename
        else:
            print('Exiting.')
            sys.exit()
    else:
        print('Links will be written to {}\n'.format(filename))
        return filename

def verify_pub_start(number):
    if number.isdecimal():
        if int(number) > 0:
            return int(number)
        else:
            print('ERROR: Publication number must be greater than 0.')
            sys.exit()
    else:
        print('ERROR: Publication number must be a positive integer.')
        sys.exit()

def verify_pub_end(number_end, number_start):
    verify_pub_start(number_end)
    if int(number_end) <= number_start:
        print('ERROR: Ending number must be greater than starting number.')
        sys.exit()
    else:
        return int(number_end)

def get_pub_data(pub_id):
    pub_url = 'https://tasvideos.org/api/v1/Publications/' + str(pub_id)
    print('Requesting data for publication', pub_id)
    return requests.get(pub_url)

def convert_pub_data(pub_id, raw_data, errors):
    try:
        raw_data.raise_for_status()
        return json.loads(raw_data.text)
    except Exception as exc:
        errors.append('ERROR with {}M: {}'.format(pub_id, exc))
        return 'Error'

def get_avi(pub_id, pub_data):
    urls = []
    for i in pub_data:
        if i[-4:] == '.avi':
            urls.append('| [{}M|{}M] | [{}|Link] |'.format(pub_id, pub_id, i))
    return urls

def save_to_file(filename, urls, t_start, t_end):
    if len(urls) > 0:
        out_file = open(filename, 'a')
        for curr_url in urls:
            out_file.write(curr_url + '\n')
        str_start = time.strftime('%Y-%m-%d %H:%M:%S', t_start)
        str_end = time.strftime('%Y-%m-%d %H:%M:%S', t_end)
        time_string = '\nLast run started at {} UTC and ended at {} UTC.'.format(str_start, str_end)
        out_file.write(time_string)
        out_file.close()

def print_errors(errors):
    num_errors = len(errors)
    if num_errors > 0:
        print('\nNumber of errors: {}\n'.format(num_errors))
        for i in errors:
            print(i)

###############
# The Process #
###############

verify_all_arguments_present(len(sys.argv))
out_filename = verify_out_filename(sys.argv[1])
pub_start = verify_pub_start(sys.argv[2])

curr_errors = []

if len(sys.argv) >= 4: # Ignore arguments beyond the expected number
    pub_end = verify_pub_end(sys.argv[3], pub_start)
    pubs_read = 0
    curr_urls = []
    time_start = time.gmtime()
    for curr_pub in range(pub_start, pub_end + 1):
        curr_data_raw = get_pub_data(curr_pub)
        curr_data_py = convert_pub_data(curr_pub, curr_data_raw, curr_errors)
        if curr_data_py != 'Error':
            curr_urls += get_avi(curr_pub, curr_data_py['urls'])
        pubs_read += 1
        if pubs_read == requests_before_wait:
            print('\nWaiting after {} requests.\n'.format(requests_before_wait))
            time.sleep(seconds_to_wait)
            pubs_read = 0
    time_end = time.gmtime()
    print('\nWriting links to {}...'.format(out_filename), end = ' ')
    save_to_file(out_filename, curr_urls, time_start, time_end)
    print('Done!')
else:
    time_start = time.gmtime()
    curr_data_raw = get_pub_data(pub_start)
    curr_data_py = convert_pub_data(pub_start, curr_data_raw, curr_errors)
    if curr_data_py != 'Error':
        curr_urls = get_avi(pub_start, curr_data_py['urls'])
        time_end = time.gmtime()
        save_to_file(out_filename, curr_urls, time_start, time_end)

print_errors(curr_errors)


TODO/AVIEncodes last edited by feos on 1/7/2024 1:53 PM
Page History Latest diff List referrers View Source