0472af001fdf47ef902c0a9a83b7acfce9f79f68 — q3cpma a month ago bcf905d
Adapt to MDex API change (why don't these monkeys maintain a changelog page for their important API changes?)
3 files changed, 9 insertions(+), 11 deletions(-)

M mdex_dl.tcl
M mdex_monitor.tcl
M mdex_util.tcl
M mdex_dl.tcl => mdex_dl.tcl +1 -1
@@ 46,7 46,7 @@ if {[regexp "^$URL_BASE_RE/title/($UUID_RE)(?:/\[^/\]+)?\$" [lindex $argv 0] -> 
	# Only keep specified chapters
	if {$argc > 1} {
		set chapters [util::lfilter ch $chapters {
			[dict get $ch data attributes chapter] in [lrange $argv 1 end]
			[dict get $ch attributes chapter] in [lrange $argv 1 end]
} else {

M mdex_monitor.tcl => mdex_monitor.tcl +1 -1
@@ 197,7 197,7 @@ foreach entry $catalog {
			file mkdir $outdir
			set atom_link $URL_BASE/chapter/[dict get $ch data id]
			set atom_link $URL_BASE/chapter/[dict get $ch id]
			puts stderr "\[[incr ch_count]/[llength $chapters]\] Downloading $ch_dirname..."
			if {[catch {dl_chapter $ch $outdir} err]} {
				puts stderr "Failed to download $outdir!\n\n$err"

M mdex_util.tcl => mdex_util.tcl +7 -9
@@ 99,7 99,7 @@ proc get_rel_groups {relationships} {

# Get chapter timestamp (using the publishAt field) in `clock seconds` format
proc get_chapter_tstamp {chapter_data} {
	clock scan [regsub {\+\d{2}:\d{2}$} [dict get $chapter_data data attributes publishAt] {}] \
	clock scan [regsub {\+\d{2}:\d{2}$} [dict get $chapter_data attributes publishAt] {}] \
		-timezone :UTC -format %Y-%m-%dT%H:%M:%S

@@ 109,7 109,7 @@ proc chapter_dirname {chapter_data lang {title ""}} {
		set title [get_rel_title [dict get $chapter_data relationships] $lang]
	set ret "$title - c"
	set num [dict get $chapter_data data attributes chapter]
	set num [dict get $chapter_data attributes chapter]
	if {[string is entier -strict $num]} {
		append ret [format %03d $num]
	} elseif {[string is double -strict $num]} {

@@ 117,7 117,7 @@ proc chapter_dirname {chapter_data lang {title ""}} {
	} else {
		append ret $num
	set vol [dict get $chapter_data data attributes volume]
	set vol [dict get $chapter_data attributes volume]
	if {$vol ne "null"} {
		if {[string is entier -strict $vol]} {
			append ret " (v[format %02d $vol])"

@@ 183,9 183,7 @@ proc get_chapter_list {mid lang} {
		set manga_feed [json::json2dict [api_get manga/$mid/feed $query_params]]
		dict incr query_params offset 500
		# Filter invalid chapters
		lappend chapters {*}[util::lfilter ch [dict get $manga_feed results] {
			[dict get $ch result] eq "ok"
		lappend chapters {*}[dict get $manga_feed data]
	} while {[dict get $manga_feed total] - [dict get $query_params offset] > 0}
	return $chapters

@@ 194,11 192,11 @@ proc get_chapter_list {mid lang} {
# Download the pages of a chapters in dirname from its JSON dict
proc dl_chapter {chapter_data dirname} {
	puts stderr "Downloading @Home server URL JSON..."
	set json [api_get at-home/server/[dict get $chapter_data data id]]
	set json [api_get at-home/server/[dict get $chapter_data id]]
	set server [dict get [json::json2dict $json] baseUrl]

	set hash [dict get $chapter_data data attributes hash]
	set pages [dict get $chapter_data data attributes data]
	set hash [dict get $chapter_data attributes hash]
	set pages [dict get $chapter_data attributes data]

	set urls [util::lprefix $pages $server/data/$hash/]
	set outnames [lmap num [util::iota [llength $pages] 1] page $pages {