XaF / TraktForVLC

Automatically trakt.tv what you're watching on VLC
300 stars 49 forks source link

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 6 years ago

brassica77 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

Hi @XaF ! Any update on this?

XaF commented 6 years ago

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 commented 6 years ago

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

XaF commented 6 years ago

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:

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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.

brassica77 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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:

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

brassica77 commented 6 years ago

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?

brassica77 commented 6 years ago

@XaF any update on this?