plex_symlinker 0.1.0 β 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +1 -2
- data/README.dockerhub.md +80 -0
- data/README.md +18 -0
- data/lib/plex_symlinker.rb +6 -4
- data/lib/plex_symlinker/version.rb +1 -1
- data/plex_symlinker.gemspec +1 -2
- metadata +3 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d23ef490e9f660776bb21694e736334eb08305d14860ec61fc31332f59d63b05
|
4
|
+
data.tar.gz: 37f932ab2732e8aa656fc0044dae683459f5ae462d1e4f6bc8c6a9d6e21ac527
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ccd7fed691c3407eb6d51a3484d261fc69ece2b21cc9cf9a4146a918498d638e63bfd77ab689ecaeb180c892bbbcca93ef82181942c34183548119c0f7c8995
|
7
|
+
data.tar.gz: e93bb0c59dd110a6f8d94caab77fc45990dba7efac8494227effb205b76877f95c22cac0dc783d3df964781b412a4d30d88140c7667fc8d2ed0ab7a212092f67
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
data/README.dockerhub.md
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# PlexSymlinker
|
2
|
+
|
3
|
+
This gem allows creating a Plex-friendly folder structure with symlinks for your audio books.
|
4
|
+
All you need are audio files with correct tagging, the gem takes care of making Plex understand them without you having to change the way you're organising your files.
|
5
|
+
|
6
|
+
**The Problem**
|
7
|
+
|
8
|
+
Most of my audio files are in apple's m4b format, leaving me with one file per book most of the times:
|
9
|
+
|
10
|
+
π audiobooks
|
11
|
+
β π author name
|
12
|
+
β book1.m4b
|
13
|
+
β book2.m4b
|
14
|
+
|
15
|
+
The problem with this structure is that Plex' music agent doesn't quite understand it.
|
16
|
+
Even though the files are properly tagged with author, album, etc., Plex tends to create a giant album out of all the files inside - often with the first audio book as album name.
|
17
|
+
|
18
|
+
What the Plex music agent expects is a structure like this:
|
19
|
+
|
20
|
+
π audiobooks
|
21
|
+
β π author name
|
22
|
+
β π Book 1
|
23
|
+
β book1.m4b
|
24
|
+
β π Book 2
|
25
|
+
β book2.m4b
|
26
|
+
|
27
|
+
This would mean that I'd have to introduce single-file-directories into my structure which didn't really make sense for me - especially as I have a lot of "HΓΆrspiele" (mostly german format of short audio books with multiple actors + music).
|
28
|
+
|
29
|
+
**This gem's solution**
|
30
|
+
|
31
|
+
PlexSymlinker creates symlinks pointing to your actual audio files in exactly the
|
32
|
+
structure Plex' music agent expects to find. It uses the embedded tags in your files to build it,
|
33
|
+
so even one big directory with all your audio files in it would work as expected.
|
34
|
+
|
35
|
+
Just point plex to the symlink directory instead of your actual files and you're good to go.
|
36
|
+
|
37
|
+
## Usage
|
38
|
+
|
39
|
+
Since the whole purpose of PlexSymlinker is to read a directory full of audio files and
|
40
|
+
fill another directory with symlinks, we have to make sure the docker container has access to both of them.
|
41
|
+
|
42
|
+
When using the docker image, the audio files directory is expected to be mounted
|
43
|
+
as `/app/source` and the directory the symlinks should be placed in as `/app/target`.
|
44
|
+
|
45
|
+
π‘ You also have to pass in the `SYMLINK_TARGET_DIR` environment variable.
|
46
|
+
Since the gem only sees `/app/source` inside the docker container,
|
47
|
+
it would point all symlinks there instead of the actual directory on your host machine.
|
48
|
+
Just set it to the same directory that you mounted as `/app/source`.
|
49
|
+
|
50
|
+
### 0. Make sure your files are properly tagged!
|
51
|
+
|
52
|
+
At least the album and album artist fields have to set accordingly.
|
53
|
+
|
54
|
+
But since you are planning to import those files into Plex which needs a lot more information,
|
55
|
+
it would make sense to fill out all details you can provide.
|
56
|
+
|
57
|
+
### 1. Create the directory the symlinks should be placed in (if it doesn't exist yet)
|
58
|
+
|
59
|
+
It's important that the directory exists (owned by your current user) before you mount it.
|
60
|
+
|
61
|
+
mkdir -p /path/to/symlink/dir
|
62
|
+
|
63
|
+
If you ran PlexSymlinker before, you can just re-run it on the same directory again.
|
64
|
+
It will automatically sync the symlinks against the actual files.
|
65
|
+
|
66
|
+
### 2. Run the docker image
|
67
|
+
|
68
|
+
#### MacOS
|
69
|
+
|
70
|
+
docker run -it --rm -v /path/to/audiobooks:/app/source:ro -v /path/to/symlink/dir:/app/target --env SYMLINK_TARGET_DIR=/path/to/audiobooks sterexx/plex_symlinker
|
71
|
+
|
72
|
+
#### Linux
|
73
|
+
|
74
|
+
π‘ Under Linux, you have to make sure to set your current user/group id
|
75
|
+
with `--user "$(id -u):$(id -g)"` - otherwise, all the generated symlinks/directories
|
76
|
+
will be owned by the root user. Docker for mac/windows takes care of that for you automatically.
|
77
|
+
|
78
|
+
docker run -it --user "$(id -u):$(id -g)" --rm -v /path/to/audiobooks:/app/source:ro -v /path/to/symlink/dir:/app/target --env SYMLINK_TARGET_DIR=/path/to/audiobooks sterexx/plex_symlinker
|
79
|
+
|
80
|
+
### 3. Create a Plex library pointing to the symlink directory
|
data/README.md
CHANGED
@@ -59,6 +59,24 @@ all necessary dependencies and can be used out-of-the-box by mounting the necess
|
|
59
59
|
|
60
60
|
### Using the gem executable
|
61
61
|
|
62
|
+
#### 0. Make sure your files are properly tagged!
|
63
|
+
|
64
|
+
At least the `album` and `album artist` fields have to set accordingly.
|
65
|
+
|
66
|
+
But since you are planning to import those files into Plex which needs a lot more information,
|
67
|
+
it would make sense to fill out all details you can provide.
|
68
|
+
|
69
|
+
#### 1. Run the gem executable with source and target directory
|
70
|
+
|
71
|
+
```bash
|
72
|
+
plex_symlinker /path/to/audiobooks /path/to/symlinks
|
73
|
+
```
|
74
|
+
|
75
|
+
π‘ If you ran PlexSymlinker before, you can just re-run it on the same directory again.
|
76
|
+
It will automatically sync the symlinks against the actual files and even delete no longer existing files.
|
77
|
+
|
78
|
+
#### 2. Create a Plex library pointing to the symlink directory
|
79
|
+
|
62
80
|
### Using the Docker image
|
63
81
|
|
64
82
|
Please refer to [Docker Hub](https://hub.docker.com/r/sterexx/plex_symlinker) for instructions
|
data/lib/plex_symlinker.rb
CHANGED
@@ -4,11 +4,13 @@ require "active_support/all"
|
|
4
4
|
require "pathname"
|
5
5
|
require "ruby-progressbar"
|
6
6
|
require "taglib"
|
7
|
-
require "zeitwerk"
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
require "plex_symlinker/file_types/audio_file"
|
9
|
+
require "plex_symlinker/file_types/mp3"
|
10
|
+
require "plex_symlinker/file_types/mp4"
|
11
|
+
require "plex_symlinker/operation"
|
12
|
+
require "plex_symlinker/symlink"
|
13
|
+
require "plex_symlinker/version"
|
12
14
|
|
13
15
|
module PlexSymlinker
|
14
16
|
class Error < StandardError; end
|
data/plex_symlinker.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
14
|
|
15
15
|
spec.metadata["homepage_uri"] = spec.homepage
|
16
|
-
spec.metadata["source_code_uri"] =
|
16
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
17
17
|
|
18
18
|
# Specify which files should be added to the gem when it is released.
|
19
19
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -28,5 +28,4 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_runtime_dependency "ruby-progressbar", "~> 1.10"
|
29
29
|
spec.add_runtime_dependency "slop", "~> 4.8"
|
30
30
|
spec.add_runtime_dependency "taglib-ruby", "~> 1.0"
|
31
|
-
spec.add_runtime_dependency "zeitwerk", "~> 2.4"
|
32
31
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plex_symlinker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Exner
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: zeitwerk
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '2.4'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '2.4'
|
83
69
|
description: 'Create a plex music agent friendly symlink structure for your audiobook
|
84
70
|
files. '
|
85
71
|
email:
|
@@ -93,12 +79,14 @@ files:
|
|
93
79
|
- ".rspec"
|
94
80
|
- ".standard.yml"
|
95
81
|
- ".travis.yml"
|
82
|
+
- CHANGELOG.md
|
96
83
|
- CODE_OF_CONDUCT.md
|
97
84
|
- Dockerfile
|
98
85
|
- Dockerfile.dev
|
99
86
|
- Gemfile
|
100
87
|
- Gemfile.lock
|
101
88
|
- LICENSE.txt
|
89
|
+
- README.dockerhub.md
|
102
90
|
- README.md
|
103
91
|
- Rakefile
|
104
92
|
- bin/ci-build-dev
|