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

Path resolution does not work for paths in the form of "file://networkname/path/to/file.mp4" (Lua: No such file or directory) #115

Open
brassica77 opened this issue Jun 7, 2018 · 20 comments
Assignees

Comments

@brassica77
Copy link

I am not sure, as this is the first time I am using both VLC and TraktForVLC, but I think I have an issue or maybe I need a clarification.
I am on Windows 10 Pro 64 bits and I am using VLC 3.0.3 64 bits.
TraktForVLC was installed successfully : I can see it in the autorized apps on Trakt.tv.
I can also see that a Service named TraktForVLC is present and running in Windows Services.
But when I launch a video file, whether it is a movie or a TV show or an anime I see nothing on Trakt.tv.

I noticed that there is absolutly no reference to Trakt in the log obtained by going in Tools/Messages if I launch a file by doube-clicking on it, but if I start VLC first, empty, and check the log window with verbose there are lines like this :
lua debug: Timers ran: { ["@trakt.lua:2365"] = false, ["@trakt.lua:1573"] = false, ["@trakt.lua:2617"] = false, }
And if I drag and drop a video file then, I get this :
lua error: Error loading script C:\Program Files\VideoLAN\VLC\lua\intf\trakt.luac: trakt.lua:313: diskstation/usbshare1/Download/alt.binaries.multimedia.anime/DARLING in the FRANXX/[Erai-raws] Darling in the FranXX - 18 [1080p][Multiple Subtitle].mkv: No such file or directory
Yet the file exists and is running fine in VLC.

Any ideas?

log.txt

@XaF
Copy link
Owner

XaF commented Jun 7, 2018

Hi @brassica77 :)

You're right! It seems to be a bug.
It seems that the file provided is file://diskstation/usbshare1/Download/alt.binaries.multimedia.anime/DARLING%20in%20the%20FRANXX/[Erai-raws]%20Darling%20in%20the%20FranXX%20-%2018%20[1080p][Multiple%20Subtitle].mkv, thus starting with file://.
Usually, on Windows, file paths starting with file:// then have the normal C:... format, which is not the case here as it starts from diskstation.

Could you tell me what is the actual path of that file if you were to access it from the command line? (either cmd or PowerShell)
Thanks!

@brassica77
Copy link
Author

brassica77 commented Jun 7, 2018

Thanks for the fast reply!
These files are on an external USB Drive connected to my Synology NAS. I think there is a NFS or samba share.
Diskstation is the name of the NAS on the network.
I can't seem to find how to access them with CMD or Powershell (maybe through net use command), but in Windows Explorer, the path is like this : \\DISKSTATION\usbshare1\Download\alt.binaries.multimedia.anime\DARLING in the FRANXX.
I copied the file locally in my PC's Downloads folder : nothing appears on Trakt.tv, and I got different errors in the log file now as you can see in the attached file.
log.txt

@brassica77
Copy link
Author

Hi,
I used a net use z: command : I can access the directory and files, but still no updates on Trakt.tv and I still have a lot of errors.
Log below.
log.txt

@brassica77
Copy link
Author

Hi @XaF !
Any update on this?

@XaF
Copy link
Owner

XaF commented Jun 11, 2018

The problem comes from the parsing of the filepath. I will have to modify the way it is currently parsed to take into account this case. This may take a bit of time however as I'm also working on another issue currently! Will try to come to it soon :)

@brassica77
Copy link
Author

Tell me if you need my help, testing betas or similar :-)

@XaF XaF changed the title Help with usage Path resolution does not work for paths in the form of "file://networkname/path/to/file.mp4" (Lua: No such file or directory) Jun 13, 2018
@XaF XaF self-assigned this Jun 13, 2018
@XaF XaF added the bug label Jun 13, 2018
@XaF
Copy link
Owner

XaF commented Jun 13, 2018

Hi @brassica77 :)
If you can help me find the right way lua could read your file, that would actually help!
I attached a trakt.lua file, could you please unzip it, remove the trakt.luac file that was installed with TraktForVLC, and put this trakt.lua file at the same place, and tell me if that works ?

If it does not:

  • Open that trakt.lua file, find the line 1908 (uri_path = '//' .. uri_path) which is a line that I added in that file (not in master) and edit it
  • The idea here is to find the way the file should be addressed, I guessed //, but it might be \\ (single backslash), \\\\ (double backslash), / (single slash) for instance. Just replace the // in the line by any of those and try. Please do report if any works... or if none do.
    Of course, if you get other ideas, please do try!

In order to check if any of those work, look for a line like the following in the logs:

lua error: Error loading script C:\Program Files\VideoLAN\VLC\lua\intf\trakt.luac: trakt.lua:313: diskstation/usbshare1/Download/alt.binaries.multimedia.anime/DARLING in the FRANXX/[Erai-raws] Darling in the FranXX - 18 [1080p][Multiple Subtitle].mkv: No such file or directory

As you can see here, the problem was that the file:// was removed and replaced by... nothing. Which is fine usually, but in this specific case of accessing a file using an UNC, it does not work. The normal way to access an UNC is the double slash //, but might be something else here. Also... it is possible it's not something we can do using VLC's Lua... In which case we'll try and find alternative solutions.

Also, last thing, lines 1907 to 1909 are not tested, just added now for your case to try and make it work. If you think that these lines are not reached (for instance if the path in the error message still starts with diskstation/ without a leading double slash), please do add some error message like vlc.msg.error('BLAH') between lines 1907 and 1908 and check if it appears in the logs.

Thanks! :)

@brassica77
Copy link
Author

I see a little progress.
With your file as it is, nothing changed : no progress on Trakt.tv, and still the same erros in the logs.
If I put in a slash or backslash, single or multiple, nothing changed when I launch a video.
So I used net use command to attach the NAS as a Z: drive, and now when I launch a video, it shows as running on Trakt.tv.
But it still shows as running, even if I pause or stop VLC.
And in the logs, I still see the connection rejected by peer errors.

@XaF
Copy link
Owner

XaF commented Jun 13, 2018

Mapping the network drive is what I was going to suggest. Nice to know it works! I will have to manage the error properly in TraktForVLC though.

Regarding the fact that it stays running, can you please share the logs? I think that there's nothing I can do for that however, as it seems to be troubles in connection between the Lua script and the Python service, but might be caused by a number of stuff that I can't really pinpoint directly... I'll still take a look at the logs!

XaF added a commit that referenced this issue Jun 14, 2018
When failing to open a file to resolve the hash, the interface was
exiting on error because of the assertion. It can happen for a
number of reasons that the file cannot be opened and this should
not prevent TraktForVLC from working properly. This commit aims
at managing the error properly by showing an error message and
aborting the hash resolution.

Relates to #115

Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>
XaF added a commit that referenced this issue Jun 14, 2018
When a network drive is not mapped to a drive letter on Windows,
the path will appear as an UNC path starting with 'file://'.
However, Lua will fail to open that file to resolve the hash.
This thus fixes that problem by changing the protocol from 'file'
to 'unc' in order to avoid trying to resolve the hash when
reading a media from an UNC path.

Relates to #115

Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>
@XaF
Copy link
Owner

XaF commented Jun 14, 2018

The dev branch now contains two commits to "manage" that kind of error properly. I'm performing a few tests on that and, if everything checks, I will merge that to master.

XaF added a commit that referenced this issue Jun 14, 2018
When failing to open a file to resolve the hash, the interface was
exiting on error because of the assertion. It can happen for a
number of reasons that the file cannot be opened and this should
not prevent TraktForVLC from working properly. This commit aims
at managing the error properly by showing an error message and
aborting the hash resolution.

Relates to #115

Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>
XaF added a commit that referenced this issue Jun 14, 2018
When a network drive is not mapped to a drive letter on Windows,
the path will appear as an UNC path starting with 'file://'.
However, Lua will fail to open that file to resolve the hash.
This thus fixes that problem by changing the protocol from 'file'
to 'unc' in order to avoid trying to resolve the hash when
reading a media from an UNC path.

Relates to #115

Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>
XaF added a commit that referenced this issue Jun 14, 2018
When failing to open a file to resolve the hash, the interface was
exiting on error because of the assertion. It can happen for a
number of reasons that the file cannot be opened and this should
not prevent TraktForVLC from working properly. This commit aims
at managing the error properly by showing an error message and
aborting the hash resolution.

Relates to #115

Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>
XaF added a commit that referenced this issue Jun 14, 2018
When a network drive is not mapped to a drive letter on Windows,
the path will appear as an UNC path starting with 'file://'.
However, Lua will fail to open that file to resolve the hash.
This thus fixes that problem by changing the protocol from 'file'
to 'unc' in order to avoid trying to resolve the hash when
reading a media from an UNC path.

Relates to #115

Signed-off-by: Raphaël Beamonte <raphael.beamonte@gmail.com>
@brassica77
Copy link
Author

brassica77 commented Jun 14, 2018

Not sure how to get the logs in this case : even if I close VLC, in my account on Trakt there is still a red progress bar with percentage running.
So if I start an episode but stop it after a few seconds, it will show as watched and completed on Trakt after the running time.

Edit : I see there is a new build : I will install it tonight when I get back home and will get you posted.

@XaF
Copy link
Owner

XaF commented Jun 14, 2018

The new build will not fix the current problem you're facing though.
How did you see the connection reset by peer messages? Usually, from the VLC log console, you can copy paste :)
You could also try running VLC using the runvlc option of the TraktForVLC binary (TraktForVLC_<version>_<os> runvlc)

@brassica77
Copy link
Author

I saw them in the message console in VLC (Ctrl+M), and I think some of them are in the logs in my previous posts in this thread.
Is the runvlc command for the logs too?

@XaF
Copy link
Owner

XaF commented Jun 14, 2018

Yss, it should run vlc in the normal way, but show you the logs in the console at the same time / after you close vlc (depending on the way the os wants to behave...)

@brassica77
Copy link
Author

brassica77 commented Jun 14, 2018

I am trying to install the new version and fail.
This is what I get (running as admin) :
`2018-06-14 18:52:34,028::INFO::Searching for VLC binary...
2018-06-14 18:52:34,028::INFO::VLC binary: C:\Program Files\VideoLAN\VLC\vlc.exe
TraktForVLC will be installed for the following configuration:

  • OS: Windows
  • VLC: C:\Program Files\VideoLAN\VLC\vlc.exe
  • VLC configuration: C:\Users\brassica\AppData\Roaming\vlc
  • VLC Lua: C:\Program Files\VideoLAN\VLC\lua
  • VLC Lua interface: C:\Program Files\VideoLAN\VLC\lua\intf
  • Service ? localhost:1984
    TraktForVLC is currently installed, replacing the current installed version will call 'uninstall' using the old binary, and 'install' with the new one.
    Proceed with installation ? [y/n] y
    2018-06-14 18:52:36,845::INFO::Uninstalling currently installed TraktForVLC
    2018-06-14 18:52:37,947::INFO::UNINSTALL::INFO::VLC binary: C:\Program Files\VideoLAN\VLC\vlc.exe
    2018-06-14 18:52:37,947::INFO::UNINSTALL::INFO::Searching for the files to remove in C:\Program Files\VideoLAN\VLC\lua
    2018-06-14 18:52:37,947::INFO::UNINSTALL::INFO::Searching for the files to remove in C:\Program Files\VideoLAN\VLC\lua\intf
    2018-06-14 18:52:37,947::INFO::UNINSTALL::INFO::Setting up VLC not to use trakt's interface
    2018-06-14 18:52:38,005::INFO::UNINSTALL::ERROR::Error while configuring VLC
    2018-06-14 18:52:38,075::ERROR::Unable to uninstall TraktForVLC
    Press a key to continue.`

EDIT : manually removed the exe in /lua, trakt files in /intf, the json files in appdata, also removed the service, rebooted, tried to install : it detects it's a new install, but still get the "Error while configuring VLC" message and fails.
EDIT2 : reset VLC, and now I can update. Tried with a video file and noticed after 10/15 seconds that Trakt is showing it being watched. If I pause the video, it will stop showing on Trakt.
I thought the issue was resolved, so I tried with another file, and not only it stopped scrobbling, but now I have a cmd window logging everything each time I launch a video : is that due to the runvlc command earlier?

@XaF
Copy link
Owner

XaF commented Jun 17, 2018

now I have a cmd window logging everything each time I launch a video

What do you mean by that ?

is that due to the runvlc command earlier?

Shouldn't be. The runvlc command only shows the logs but should run VLC the same way. What kind of log are you talking about that shows in the cmd window ? VLC log?

but still get the "Error while configuring VLC" message and fails

Would be interesting to have the debug messages relative to that! Without knowing what fails, I cannot check how to fix it!

@brassica77
Copy link
Author

I had to reset VLC settings and no more "Error while configuring VLC" message.
I could remove the cmd windows that was launching each time I launch a video by unticking the LUA Interpreter option in Preferences/Interface/Main Interface. But doing so completly disabled TraktForVLC.
Uninstalled and launched again the installation but got back to the "Connection refused by peer" error.
Log attached.
log.txt

@XaF
Copy link
Owner

XaF commented Jun 17, 2018

The connection reset by peer comes from the fact that either the service is not installed, not started, or not accepting connections!

@brassica77
Copy link
Author

I can see the service in the services list, it is listed as running and automtaic start up.
I can also see trakt_helper.exe running in the task manager.
I also add it to the authorized softwares for connexions in Windows Firewall.
I don't know what else I could I have missed.

I tried a software called Taiga that basically does the same thing as TraktForVLC, except for animes only and anime related websites, and scrobbling is working, both with VLC and MPC-HC.

I also installed Kodi, added the Trakt plugin, and set either VLC and MPC-HC as external players, and scrobbling is working too.

And in these two cases, Taiga and Kodi, everything work without needing to add a Z:\ drive for the network path.

Any idea what I could test next?

@XaF XaF removed the bug label Jun 23, 2018
@brassica77
Copy link
Author

@XaF any update on this?

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