package Ġupload . res um able Ċ Ċ import Ġauth . Authorization Ċ import Ġcom . google . api . services . youtube . model . Video Ċ import Ġconfig . json Mapper Ċ import Ġexec . app Directory Ċ import Ġjavafx . scene . control . Alert Ċ import Ġjavafx . scene . control . Button Type Ċ import Ġui . alert . Sized Alert Ċ import Ġupload . Upload Service Ċ import Ġjava . io . File Ċ Ċ object ĠUn finished Upload Load Service Ġ{ ĊĊĠĠĠ Ġval ĠUN FINISHED _ UPLOAD _ DIRECTORY Ġ= ĠFile ("$ app Directory / uploads ") ĊĊĠĠĠ Ġfun Ġload Un finished Upload s (): ĠList < Rest orable Upload > Ġ= Ġjson Mapper . readValue ( Upload Service . UPLOAD _ QUEUE _ FILE , ĠArray < Rest orable Upload >:: class . java ). asList () ĊĊĠĠĠ Ġfun Ġdelete Un finished Upload s () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġfailed Upload s Ġ= Ġfind Failed Upload s () ĊĠĠĠĠĠĠĠ Ġif Ġ( failed Upload s . isNotEmpty ()) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġfailed Titles Ġ= Ġfailed Upload s . join ToString ("\ n ", Ġtransform Ġ= Ġ{ Ġit . snippet . title Ġ}) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġresponse Ġ= ĠSized Alert ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠAlert . Alert Type . CONFIRM ATION , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" There Ġare Ġsome Ġfailed Ġuploads Ġfor Ġyour Ġaccount . ĠDo Ġyou Ġwant Ġto Ġdelete Ġthem ?\ n ( Be Ġaware , Ġthat Ġthis Ġfeature Ġis Ġstill Ġin Ġdevelopment Ġand Ġdeleted Ġvideos Ġcan Ġnot Ġbe Ġre covered . )\ n \ n Titles Ġof Ġthe Ġfailed Ġuploads :\ n $ failed Titles ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠButton Type . YES , ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠButton Type . NO ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ). show And Wait () ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġif Ġ( response . isPresent Ġ&& Ġresponse . get () Ġ== ĠButton Type . YES ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġfailed Upload s . forEach Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ ĠAuthorization . connection . videos (). delete ( it . id ). execute () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ// ĠTODO : Ġprocessing Failure Reason Ġis Ġnot Ġfilled Ġcorrectly Ġby ĠYouTube ; Ġnot Ġyet Ġimplemented Ġcorrectly ? ĊĠĠĠ Ġprivate Ġfun Ġfind Failed Upload s ( videos To Look At : ĠInt Ġ= Ġ 5 ): ĠList < Video > Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġupload List Id Ġ= ĠAuthorization . connection . Channels () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. list (" content Details ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Mine ( true ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. execute () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. items [ 0 ]. content Details . related Play lists . uploads ĊĊĠĠĠĠĠĠĠ Ġval Ġuploads Ġ= ĠAuthorization . connection . playlist Items () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. list (" content Details ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. set Playlist Id ( upload List Id ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. setMax Results ( videos To Look At . to Long ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. execute () ĊĊĠĠĠĠĠĠĠ Ġreturn ĠAuthorization . connection . videos () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. list (" snippet , processing Details ") ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. setId ( uploads . items . join ToString (",", Ġtransform Ġ= Ġ{ Ġit . content Details . video Id Ġ})) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. execute () ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. items ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. filter Ġ{ Ġit . processing Details . processing Failure Reason Ġ== Ġ" upload Failed " Ġ} ĊĠĠĠ Ġ} Ċ }