Downloaded subtitles are not saved 'Next to video' anymore

Since the latest update (May 2019 2019.05-2), subtitles aren’t saved ‘Next to the video’ anymore, even the settings says so. It always uses the ‘Custom subtitle folder’.

I notice this behavior for both service.subtitles.opensubtitles and service.subtitles.addic7ed.

Situation:

  • after the May 2019-update, subtitles aren’t saved ‘Next to the video’ anymore (my current setting).

Steps I did to reproduce:

  • go to Settings/player
  • change storage location to ‘Custom location’
  • set Custom subtitle folder to a public folder on my NAS
  • download and save a subtitle
  • subtitles are successfully saved in the custom location

– change the setting back to ‘next to the video’ –

  • go to Settings/player
  • change storage location to ‘Next to the video’
  • I did not change Custom subtitle folder (path cannot be reset/emptied)
  • download and save a subtitle
  • subtitles are still saved in the custom location

Logs (this covers the last 5 bullets): http://paste.osmc.io/emapufiluf.vhdl

Do you use Kodi on any devices that don’t run OSMC? If so, can you test on those?

If the problem happens on those as well, it’s almost certainly not an OSMC bug.

Unfortunately not, I only have a Raspberry Pi 2B which runs on OSMC. So I have no easy way to reproduce this with pure Kodi.

If this is a Kodi issue, is there a way to do some debugging in my OSMC environment?

The first thing to check is threads in the Kodi subtitle add-on forum to see if other people have similar issues. If they do, and they aren’t using OSMC, then all you can really do is a “me too” on the bug there, and hope it gets fixed by either Kodi devs or the people that wrote the subtitle add-ons.

I’ll do that!

One interesting thing I just found out. It looks like this problem is related to (the connection to) my NAS. Because subtitles are saved next to video’s that are on a HDD connected directly to the Pi.

Maybe I could try to remove and re-add the NAS-source in OSMC?

How do you connect to the NAS (SMB, NFS, etc.)? Do you mount in fstab, or do you use Kodi’s built in protocols?

Based on searching Google for kodi save subtitles "next to the video", it’s quite likely a permissions issue not allowing the files to be saved.

You really need to post full debug logs: grab-logs -A

While we can probably make a guess, based on the log, it will help if you can spell out such details.

@nabsltd

How do you connect…

I connect to the NAS via NFS using the OSMC UI (Video > Add source > Network > 192.168.11.14 > select /Series folder > OK).

Do you mount in fstab, or do you use Kodi’s built in protocols?

I guess the latter. I just connect my HDD and then it’s visible in Kodi.

it’s quite likely a permissions issue not allowing the files to be save

I did that search and the conclusion in how to make kodi save subs for a movie that is on a remote resource is: “Solution: give write permissions to the group “others” for the shared folder on the Linux PC.”

I tried that in different ways (but non of these fixed the problem):

  • give ‘777’ permission to specific Series-folder on my NAS
    • to be specific: /Series/Chicago P.D/Season 05/
  • give user/group osmc:osmc r/w permissions on the complete /Series folder
  • made the complete /Series folder ‘public’

Btw. removing and re-adding the NAS-source in OSMC didn’t work out as well.

@dillthedog

post full debug logs

My bad (I enabled debugging via ‘ctrl+shift+D’). I’ll use the grab-logs -A-way and post the logs again!

set Custom subtitle folder to a public folder on my NAS

spell out such details

Custom subtitle folder was set to nfs://192.168.11.14/DataVolume/public/subtitles

I’ll come back to you with the full debug logs. I’ll perform all steps in the bullets I mentioned above.

Another thing to verify is that the UID/GID of the osmc user/group is identical on the Pi and the NAS. On OSMC, the UID and GID for osmc are both 1000.

Hi @dillthedog,

You really need to post full debug logs: grab-logs -A

The logs: [removed link as they are no longer needed]

The steps I performed:

  • storage location-setting is: ‘next to the video’
  • enable logs + reboot
  • navigate to Series episode
    • play, find subs, select one and download, stop playing
  • set storage location-setting to: ‘custom location’ > nfs://192.168.11.14/DataVolume/public/subtitles
  • navigate to Series episode
    • play, find subs, select one and download, stop playing
  • set storage location-setting to: ‘next to the video’
  • navigate to Series episode
    • play, find subs, select one and download, stop playing
  • grab-logs
  • stop logging

Here’s what the log shows:

1: storage location-setting is: ‘next to the video’

2019-06-17 22:59:07.148 T:1467810528   DEBUG: ScanForExternalSubtitles: Searching for subtitles...
2019-06-17 22:59:07.155 T:1467810528   DEBUG: NFS: Context for 192.168.11.14/DataVolume/public not open - get a new context.
2019-06-17 22:59:07.204 T:1467810528   DEBUG: NFS: Connected to server 192.168.11.14 and export /DataVolume/public
2019-06-17 22:59:07.204 T:1467810528   DEBUG: NFS: chunks: r/w 16384/16384
2019-06-17 22:59:07.209 T:1915225648   DEBUG: ------ Window Init (DialogBusy.xml) ------
2019-06-17 22:59:07.228 T:1467810528   DEBUG: ScanForExternalSubtitles: END (total time: 80 ms)

2: set storage location-setting to: ‘custom location’ > nfs://192.168.11.14/DataVolume/public/subtitles

2019-06-17 23:00:12.196 T:1764934368   DEBUG: ScanForExternalSubtitles: Searching for subtitles...
2019-06-17 23:00:12.196 T:1915225648   DEBUG: CVideoGUIInfo::InitCurrentItem(videodb://inprogresstvshows/5/1/727?season=1&tvshowid=5)
2019-06-17 23:00:12.197 T:1915225648   DEBUG: CPlayerGUIInfo::InitCurrentItem(videodb://inprogresstvshows/5/1/727?season=1&tvshowid=5)
2019-06-17 23:00:12.197 T:1915212512   DEBUG: CAnnouncementManager - Announcement: OnChanged from xbmc
2019-06-17 23:00:12.197 T:1915212512   DEBUG: GOT ANNOUNCEMENT, type: 1024, from xbmc, message OnChanged
2019-06-17 23:00:12.197 T:1915212512   DEBUG: CAnnouncementManager - Announcement: OnPlay from xbmc
2019-06-17 23:00:12.197 T:1915212512   DEBUG: GOT ANNOUNCEMENT, type: 1, from xbmc, message OnPlay
2019-06-17 23:00:12.204 T:1764934368   DEBUG: NFS: Refreshing context for 192.168.11.14/DataVolume/public, old: 72537, new: 89200
2019-06-17 23:00:12.204 T:1764934368   DEBUG: NFS: Using cached context.
2019-06-17 23:00:12.207 T:1764934368   DEBUG: ScanForExternalSubtitles: END (total time: 11 ms)

3: set storage location-setting to: ‘next to the video’

2019-06-17 23:01:12.442 T:1416622816   DEBUG: ScanForExternalSubtitles: Searching for subtitles...
2019-06-17 23:01:12.442 T:1915212512   DEBUG: CAnnouncementManager - Announcement: OnChanged from xbmc
2019-06-17 23:01:12.443 T:1915212512   DEBUG: GOT ANNOUNCEMENT, type: 1024, from xbmc, message OnChanged
2019-06-17 23:01:12.443 T:1915212512   DEBUG: CAnnouncementManager - Announcement: OnPlay from xbmc
2019-06-17 23:01:12.443 T:1915212512   DEBUG: GOT ANNOUNCEMENT, type: 1, from xbmc, message OnPlay
2019-06-17 23:01:12.449 T:1416622816   DEBUG: NFS: Refreshing context for 192.168.11.14/DataVolume/public, old: 115211, new: 149445
2019-06-17 23:01:12.449 T:1416622816   DEBUG: NFS: Using cached context.
2019-06-17 23:01:12.453 T:1416622816   DEBUG: ScanForExternalSubtitles: END (total time: 11 ms)

In all three cases, it’s using 192.168.11.14/DataVolume/public. And after the third attempt, the Kodi custom path setting is still set to 192.168.11.14/DataVolume/public:

<setting id="subtitles.custompath">nfs://192.168.11.14/DataVolume/public/subtitles/</setting>

Without checking the code, I’m guessing that this setting takes precedence over “next to video”. You therefore need to edit the file guisettings.xml and change the custom path to:

<setting id="subtitles.custompath" default="true"></setting>

systemctl stop mediacenter
nano ~/.kodi/userdata/guisettings.xml
systemctl start mediacenter

We can see that the custom path seems to work, so please repeat the test only for “next to video” and post a new Kodi log: grab-logs -X

I adjusted the setting and ran the test again. Logs: http://paste.osmc.io/gulitoriko.xml

Steps performed:

  • edited xml
  • enable logs + reboot
  • navigate to Series episode
    • play, find subs, select one and download, stop playing
  • stop logging
  • grab-logs -X

Hi @dillthedog,

Any chance you had the time to take a look at the logs and spot a possible cause of the problem?

Thanks!

@nabsltd

Another thing to verify is that the UID/GID of the osmc user/group is identical on the Pi and the NAS. On OSMC, the UID and GID for osmc are both 1000.

Thanks for the follow-up. I can’t seem to find a UID/GID in the NAS admin. It’s just the name without ID’s. However, I also enabled ‘public access’ on my NAS, and that doesn’t solve the problem either.

Hi. Sorry I missed your reply.

A few points.

  1. Please provide full logs next time.
  2. What’s the role of Plex in your set-up? I see it mentioned in the log.
  3. Have you demonstrated that you can write to the NFS share from user osmc?
  4. You’re using Kodi-based NFS. Have you tried with an fstab (or autofs) mount? (Perhaps it doesn’t work with Kodi-based NFS.)
  5. Nothing stands out in the log you provided.

Hi @dillthedog,

  1. What parts did you miss? I was under the impression that I did provide full logs (see steps above). I do have logs including the part where I change the setting in the XML, but I think I messed up that test.
  2. Plex is just the plugin to stream media from an external server. I never use it, so I could remove it.
  3. I guess I could test that by ssh-ing as osmc to my pi, and then writing some file to the NAS? Or should I test that otherwise? By the way: subs that were written to the custom folder have user:group ftp:ftp.
  4. I’ll try that
  5. Thanks for looking into it!
  1. Only Kodi logs were provided.
  2. Ok.
  3. You’d have to mount the share first. The ftp:ftp user:group is very intesresting. Good spot.

Hi @dillthedog,

I tried the mount suggestion, but still no luck:

osmc@osmc:~$ sudo mkdir /mnt/NAS
osmc@osmc:~$ sudo mount -t nfs 192.168.11.14:/DataVolume/Series /mnt/NAS 

The mount command shows:

192.168.11.14:/DataVolume/Series on /mnt/NAS type nfs (rw,relatime,vers=3,rsize=16384,wsize=16384,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.11.14,mountvers=3,mountport=656,mountproto=udp,local_lock=none,addr=192.168.11.14)

Then I added the mount as a source in osmc. After scanning/adding the media, I ran the ‘download subtitles’ command on some series, but no subtitles were saved next to the video. I didn’t try to mount with username/pwd, but I did set ‘public access’ on the folder in NAS admin.

The ftp:ftp user:group is very intesresting. Good spot.

I also tried to add user/group ftp:ftp in my NAS admin, but those names are reserved.

On Linux, the user name is just a name. The important part is the user id (UID). On your OSMC system you can verify the UID of ftp by

osmc@yeti:~$ id ftp
uid=111(ftp) gid=116(ftp) groups=116(ftp)
osmc@yeti:~$   

Then check (on the NAS)

$ id 111

to find what the actual user name for UID 111 is.

Solid stuff.

  1. You still need to demonstrate that user osmc can write to the NAS. And repeat for user ftp. (Try sudo -s then sudo -u ftp touch <filename>)
  2. You didn’t mention if you removed the Kodi-based source that you’ve effectively moved to /mnt/NAS.
  3. Just FYI, but there is no user ftp on either of my two OSMC boxes.

Hi @bmillham,

Here my results:

osmc@osmc:~$ id ftp
id: 'ftp': no such user
osmc@osmc:~$ id osmc
uid=1000(osmc) gid=1000(osmc) groups=1000(osmc),4(adm),6(disk),7(lp),20(dialout),24(cdrom),29(audio),44(video) 

Then check (on the NAS)

SSH’ing to my NAS should be possible, but there seems to be a problem…

me@MacBook:~ $ ssh root@192.168.11.14
ssh: connect to host 192.168.11.14 port 22: Connection refused

@dillthedog, the results

osmc@osmc:~$ sudo -s
root@osmc:/home/osmc# sudo -u ftp touch test.txt
sudo: unknown user: ftp
sudo: unable to initialize policy plugin
root@osmc:/home/osmc# ls -l
total 16
drwxr-xr-x 2 osmc osmc 4096 Aug  5  2018 Movies
drwxr-xr-x 2 osmc osmc 4096 Aug  5  2018 Music
drwxr-xr-x 2 osmc osmc 4096 Aug  5  2018 Pictures
drwxr-xr-x 2 osmc osmc 4096 Aug  5  2018 TV Shows
root@osmc:/home/osmc# sudo -u osmc touch test.txt
root@osmc:/home/osmc# ls -l
total 16
drwxr-xr-x 2 osmc osmc 4096 Aug  5  2018 Movies
drwxr-xr-x 2 osmc osmc 4096 Aug  5  2018 Music
drwxr-xr-x 2 osmc osmc 4096 Aug  5  2018 Pictures
drwxr-xr-x 2 osmc osmc 4096 Aug  5  2018 TV Shows
-rw-r--r-- 1 osmc osmc    0 Jun 25 23:08 test.txt 
  1. I added the mount next to the nfs: share. So after indexing I had a lot of duplicate series. I downloaded subs for the series in the just added mount.

  2. Just for the record, this is where I see the ftp:ftp group/owner. These subs were saved here when my setting was ‘custom location’.