Parse youtube-dl progress output
Which lets progress be displayed when doing concurrent downloads. Amoung other things, like --json-progress etc. The youtube-dl output is no longer displayed, except for any errors. This commit was sponsored by Denis Dzyubenko on Patreon.
This commit is contained in:
parent
4c7335caf3
commit
4c32499e82
9 changed files with 117 additions and 49 deletions
|
@ -114,7 +114,7 @@ rsyncUrlIsPath s
|
|||
-}
|
||||
rsyncProgress :: OutputHandler -> MeterUpdate -> [CommandParam] -> IO Bool
|
||||
rsyncProgress oh meter ps =
|
||||
commandMeter' parseRsyncProgress oh meter "rsync" (rsyncParamsFixup ps) >>= \case
|
||||
commandMeterExitCode parseRsyncProgress oh Nothing meter "rsync" (rsyncParamsFixup ps) >>= \case
|
||||
Just ExitSuccess -> return True
|
||||
Just (ExitFailure exitcode) -> do
|
||||
when (exitcode /= 1) $
|
||||
|
@ -136,10 +136,10 @@ rsyncProgress oh meter ps =
|
|||
parseRsyncProgress :: ProgressParser
|
||||
parseRsyncProgress = go [] . reverse . progresschunks
|
||||
where
|
||||
go remainder [] = (Nothing, remainder)
|
||||
go remainder [] = (Nothing, Nothing, remainder)
|
||||
go remainder (x:xs) = case parsebytes (findbytesstart x) of
|
||||
Nothing -> go (delim:x++remainder) xs
|
||||
Just b -> (Just (toBytesProcessed b), remainder)
|
||||
Just b -> (Just (toBytesProcessed b), Nothing, remainder)
|
||||
|
||||
delim = '\r'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue