Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloading m3u8 file issue - only works from Xcode and json.decoder.JSONDecodeError #15

Closed
majedoh opened this issue Jul 24, 2023 · 4 comments

Comments

@majedoh
Copy link

majedoh commented Jul 24, 2023

Hello,

I am encountering two issues with the argv for downloading an m3u8 file.

let argv: [String] = (
    url.pathExtension == "mp4"
    ? ["-o", url.lastPathComponent,]
    : [
        "-f", "hls-2176",
        "-S","ext:mp4:m4a",
    ]
)
+ [
    "--no-check-certificates",
    url.absoluteString,
]

1st Issue: App functioning only when running from Xcode

The download only works when the app is run from Xcode. If I close Xcode and reopen it, the download no longer functions. Here are the steps to reproduce the issue:

  1. Clone the repository.
  2. Run the app from Xcode.
  3. Close the app.
  4. Open the app manually - not by running the project from Xcode.
  5. Attempt to download the sample URL using the provided argv.

I've included a screenshot of the issue:

IMG_2782

2nd Issue: json.decoder.JSONDecodeError

While the app is running via Xcode and the download is complete, I encounter the following error:

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
startDownload(url:) Error Domain=App Code=1 "ERROR: Expecting value: line 1 column 1 (char 0)" UserInfo={NSLocalizedDescription=ERROR: Expecting value: line 1 column 1 (char 0)}

Steps to reproduce the issue:

  1. Run the app from Xcode.
  2. Attempt to download the sample URL using the provided argv.

Here are the screenshots of the second issue:

Screenshot 2023-07-24 at 11 10 25 AM Screenshot 2023-07-24 at 11 10 08 AM

I would appreciate any help or guidance with these issues.

@majedoh
Copy link
Author

majedoh commented Jul 24, 2023

Easier steps to reproduce the first issue:
1- Edit Scheme
2- Run Tap
3- Change Launch configuration to " wait for executable to be launched"
4- Run the app,
5-Attempt to download the sample URL using the provided argv.

Screenshot 2023-07-24 at 3 45 42 PM
let argv: [String] = (
    url.pathExtension == "mp4"
    ? ["-o", url.lastPathComponent,]
    : [
        "-f", "hls-2176",
        "-S","ext:mp4:m4a",
    ]
)
+ [
    "--no-check-certificates",
    url.absoluteString,
]

@majedoh majedoh closed this as completed Jul 24, 2023
@majedoh majedoh reopened this Jul 24, 2023
@majedoh
Copy link
Author

majedoh commented Jul 25, 2023

@kewlbear Any tips on how can I address it?

@kewlbear
Copy link
Owner

For the second issue, you can see which field missing in the debugger and change it to optional. First issue may require adding some logging and watching it from console app.

@majedoh
Copy link
Author

majedoh commented Aug 3, 2023

Solution:
The problem is occurring in the following line of var:
lazy var popenHandler = PythonFunction { args in
Specifically, the issue is with this line:
result[0] = read(pipe: outPipe)
To resolve this, simply set the value of the result[0] manually.

@majedoh majedoh closed this as completed Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants