xxx_rename 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/codeql-analysis.yml +42 -0
  3. data/.github/workflows/ruby.yml +44 -0
  4. data/.gitignore +12 -0
  5. data/.rspec +3 -0
  6. data/.rubocop.yml +41 -0
  7. data/.ruby-version +1 -0
  8. data/Gemfile +6 -0
  9. data/Gemfile.lock +174 -0
  10. data/README.md +319 -0
  11. data/Rakefile +12 -0
  12. data/bin/console +23 -0
  13. data/bin/install +22 -0
  14. data/bin/setup +8 -0
  15. data/codecov.yml +2 -0
  16. data/docs/DEVELOPMENT.md +42 -0
  17. data/exe/xxx_rename +12 -0
  18. data/lib/xxx_rename/actions/base_action.rb +20 -0
  19. data/lib/xxx_rename/actions/log_new_filename.rb +40 -0
  20. data/lib/xxx_rename/actions/resolver.rb +32 -0
  21. data/lib/xxx_rename/actions/stash_app_post_movie.rb +62 -0
  22. data/lib/xxx_rename/actors_helper.rb +117 -0
  23. data/lib/xxx_rename/cli.rb +211 -0
  24. data/lib/xxx_rename/client.rb +110 -0
  25. data/lib/xxx_rename/constants.rb +96 -0
  26. data/lib/xxx_rename/contract/config_contract.rb +241 -0
  27. data/lib/xxx_rename/contract/config_generator.rb +207 -0
  28. data/lib/xxx_rename/contract/file_rename_op_contract.rb +54 -0
  29. data/lib/xxx_rename/contract/types.rb +10 -0
  30. data/lib/xxx_rename/core_extensions/string.rb +39 -0
  31. data/lib/xxx_rename/data/base.rb +34 -0
  32. data/lib/xxx_rename/data/config.rb +97 -0
  33. data/lib/xxx_rename/data/file_rename_op.rb +42 -0
  34. data/lib/xxx_rename/data/file_rename_op_datastore.rb +111 -0
  35. data/lib/xxx_rename/data/naughty_america_database.rb +22 -0
  36. data/lib/xxx_rename/data/query_interface.rb +78 -0
  37. data/lib/xxx_rename/data/scene_data.rb +71 -0
  38. data/lib/xxx_rename/data/scene_datastore.rb +401 -0
  39. data/lib/xxx_rename/data/site_config.rb +84 -0
  40. data/lib/xxx_rename/data/types.rb +13 -0
  41. data/lib/xxx_rename/errors.rb +28 -0
  42. data/lib/xxx_rename/file_scanner.rb +49 -0
  43. data/lib/xxx_rename/file_utilities.rb +38 -0
  44. data/lib/xxx_rename/filename_generator.rb +173 -0
  45. data/lib/xxx_rename/integrations/base.rb +20 -0
  46. data/lib/xxx_rename/integrations/stash_app.rb +316 -0
  47. data/lib/xxx_rename/log.rb +26 -0
  48. data/lib/xxx_rename/migration_client.rb +139 -0
  49. data/lib/xxx_rename/processed_file.rb +203 -0
  50. data/lib/xxx_rename/search.rb +166 -0
  51. data/lib/xxx_rename/site_client_matcher.rb +299 -0
  52. data/lib/xxx_rename/site_clients/adult_time.rb +31 -0
  53. data/lib/xxx_rename/site_clients/algolia_common.rb +48 -0
  54. data/lib/xxx_rename/site_clients/algolia_v2.rb +181 -0
  55. data/lib/xxx_rename/site_clients/babes.rb +15 -0
  56. data/lib/xxx_rename/site_clients/base.rb +61 -0
  57. data/lib/xxx_rename/site_clients/blacked.rb +12 -0
  58. data/lib/xxx_rename/site_clients/blacked_raw.rb +12 -0
  59. data/lib/xxx_rename/site_clients/brazzers.rb +15 -0
  60. data/lib/xxx_rename/site_clients/configuration.rb +55 -0
  61. data/lib/xxx_rename/site_clients/digital_playground.rb +15 -0
  62. data/lib/xxx_rename/site_clients/elegant_angel.rb +168 -0
  63. data/lib/xxx_rename/site_clients/errors.rb +103 -0
  64. data/lib/xxx_rename/site_clients/evil_angel.rb +59 -0
  65. data/lib/xxx_rename/site_clients/goodporn.rb +109 -0
  66. data/lib/xxx_rename/site_clients/jules_jordan.rb +22 -0
  67. data/lib/xxx_rename/site_clients/jules_jordan_media.rb +175 -0
  68. data/lib/xxx_rename/site_clients/manuel_ferrara.rb +24 -0
  69. data/lib/xxx_rename/site_clients/mg_premium.rb +247 -0
  70. data/lib/xxx_rename/site_clients/mofos.rb +15 -0
  71. data/lib/xxx_rename/site_clients/naughty_america.rb +272 -0
  72. data/lib/xxx_rename/site_clients/nfbusty.rb +84 -0
  73. data/lib/xxx_rename/site_clients/query_generator/base.rb +89 -0
  74. data/lib/xxx_rename/site_clients/query_generator/evil_angel.rb +36 -0
  75. data/lib/xxx_rename/site_clients/query_generator/goodporn.rb +27 -0
  76. data/lib/xxx_rename/site_clients/query_generator/mg_premium.rb +26 -0
  77. data/lib/xxx_rename/site_clients/query_generator/naughty_america.rb +24 -0
  78. data/lib/xxx_rename/site_clients/query_generator/stash_db.rb +21 -0
  79. data/lib/xxx_rename/site_clients/query_generator/vixen.rb +27 -0
  80. data/lib/xxx_rename/site_clients/query_generator/whale.rb +39 -0
  81. data/lib/xxx_rename/site_clients/reality_kings.rb +14 -0
  82. data/lib/xxx_rename/site_clients/stash_db.rb +257 -0
  83. data/lib/xxx_rename/site_clients/tushy.rb +12 -0
  84. data/lib/xxx_rename/site_clients/tushy_raw.rb +12 -0
  85. data/lib/xxx_rename/site_clients/twistys.rb +15 -0
  86. data/lib/xxx_rename/site_clients/vixen.rb +12 -0
  87. data/lib/xxx_rename/site_clients/vixen_media.rb +130 -0
  88. data/lib/xxx_rename/site_clients/whale.rb +106 -0
  89. data/lib/xxx_rename/site_clients/wicked.rb +52 -0
  90. data/lib/xxx_rename/site_clients/x_empire.rb +51 -0
  91. data/lib/xxx_rename/site_clients/zero_tolerance.rb +36 -0
  92. data/lib/xxx_rename/utils.rb +81 -0
  93. data/lib/xxx_rename/version.rb +5 -0
  94. data/lib/xxx_rename.rb +60 -0
  95. data/output.png +0 -0
  96. data/xxx_rename.gemspec +42 -0
  97. metadata +411 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1f2ab66c24ad8843af4181a46ceeb6c14803f69d3402d0249aa271b1eb70e235
4
+ data.tar.gz: d70c0efcc455708d3d761a9efc51ca5be69c8cd1a688b20dae40798cea72d532
5
+ SHA512:
6
+ metadata.gz: 8a032226ed92ab39088d538aef98c14ed5580759d5ff83cb1117c4803688371cd6269aa38a51b3f9c2ededb54b6427cd8e17de040465318fd81bec88d7f9c1e0
7
+ data.tar.gz: 287f229670366353be4cedad9563b3cba54b22a42538ecfeb0375263a3d275d54e701e4b049dd5feb8299db71dc54ea9ac22d829c630eee22a9d3975721d7d26
@@ -0,0 +1,42 @@
1
+ name: "CodeQL"
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ # The branches below must be a subset of the branches above
8
+ branches: [ main ]
9
+ schedule:
10
+ - cron: '45 7 * * 3'
11
+
12
+ jobs:
13
+ analyze:
14
+ name: Analyze
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ actions: read
18
+ contents: read
19
+ security-events: write
20
+
21
+ strategy:
22
+ fail-fast: false
23
+ matrix:
24
+ language: [ 'ruby' ]
25
+
26
+ steps:
27
+ - name: Checkout repository
28
+ uses: actions/checkout@v2
29
+
30
+ # Initializes the CodeQL tools for scanning.
31
+ - name: Initialize CodeQL
32
+ uses: github/codeql-action/init@v1
33
+ with:
34
+ languages: ${{ matrix.language }}
35
+
36
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
37
+ # If this step fails, then you should remove it and run the build manually (see below)
38
+ - name: Autobuild
39
+ uses: github/codeql-action/autobuild@v1
40
+
41
+ - name: Perform CodeQL Analysis
42
+ uses: github/codeql-action/analyze@v1
@@ -0,0 +1,44 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ main ]
13
+ pull_request:
14
+ branches: [ main ]
15
+
16
+ jobs:
17
+ test:
18
+
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ ruby-version: ['2.7']
23
+
24
+ steps:
25
+ - uses: actions/checkout@v2
26
+ - name: Set up Ruby
27
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
28
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
29
+ uses: ruby/setup-ruby@v1
30
+ with:
31
+ ruby-version: ${{ matrix.ruby-version }}
32
+ bundler-cache: true
33
+ cache-version: 3
34
+ - name: Run tests
35
+ run: bundle exec rake
36
+
37
+ - name: Run CodeCov
38
+ uses: codecov/codecov-action@v2
39
+ with:
40
+ files: ./coverage/.resultset.json
41
+ flags: unittests # optional
42
+ name: codecov-umbrella # optional
43
+ fail_ci_if_error: true
44
+ verbose: true
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ .idea
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format progress
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,41 @@
1
+ Style/StringLiterals:
2
+ Enabled: true
3
+ EnforcedStyle: double_quotes
4
+
5
+ Style/StringLiteralsInInterpolation:
6
+ Enabled: true
7
+ EnforcedStyle: double_quotes
8
+
9
+ Layout/LineLength:
10
+ Max: 150
11
+
12
+ Documentation:
13
+ Enabled: false
14
+
15
+ AllCops:
16
+ TargetRubyVersion: 2.7.0
17
+ SuggestExtensions: false
18
+
19
+ Metrics/MethodLength:
20
+ Enabled: false
21
+
22
+ Metrics/ParameterLists:
23
+ Enabled: false
24
+
25
+ Metrics/AbcSize:
26
+ Enabled: false
27
+
28
+ Metrics/ClassLength:
29
+ Enabled: false
30
+
31
+ Style/OptionalBooleanParameter:
32
+ Enabled: false
33
+
34
+ Style/ClassVars:
35
+ Enabled: false
36
+
37
+ Metrics/BlockLength:
38
+ IgnoredMethods: [ 'describe', 'context' ]
39
+ Exclude:
40
+ - spec/**/*
41
+ - xxx_rename.gemspec
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.6
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in xxx_rename.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,174 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ xxx_rename (0.0.1)
5
+ activesupport (~> 7.0)
6
+ algolia (~> 2.3)
7
+ awesome_print (~> 1.9)
8
+ colorize (~> 0.8.1)
9
+ deep_merge (~> 1.2)
10
+ dry-struct (~> 1.4)
11
+ dry-types (~> 1.5)
12
+ dry-validation (~> 1.8)
13
+ httparty (>= 0.18.1, < 0.22.0)
14
+ nokogiri (~> 1.12)
15
+ rake (~> 13.0)
16
+ thor (~> 1.1)
17
+
18
+ GEM
19
+ remote: https://rubygems.org/
20
+ specs:
21
+ activesupport (7.0.4)
22
+ concurrent-ruby (~> 1.0, >= 1.0.2)
23
+ i18n (>= 1.6, < 2)
24
+ minitest (>= 5.1)
25
+ tzinfo (~> 2.0)
26
+ addressable (2.8.0)
27
+ public_suffix (>= 2.0.2, < 5.0)
28
+ algolia (2.3.1)
29
+ faraday (>= 0.15, < 3)
30
+ faraday-net_http_persistent (>= 0.15, < 3)
31
+ multi_json (~> 1.0)
32
+ net-http-persistent
33
+ ast (2.4.2)
34
+ awesome_print (1.9.2)
35
+ codecov (0.6.0)
36
+ simplecov (>= 0.15, < 0.22)
37
+ coderay (1.1.3)
38
+ colorize (0.8.1)
39
+ concurrent-ruby (1.1.10)
40
+ connection_pool (2.3.0)
41
+ crack (0.4.5)
42
+ rexml
43
+ deep_merge (1.2.2)
44
+ diff-lcs (1.5.0)
45
+ docile (1.4.0)
46
+ dry-configurable (0.14.0)
47
+ concurrent-ruby (~> 1.0)
48
+ dry-core (~> 0.6)
49
+ dry-container (0.9.0)
50
+ concurrent-ruby (~> 1.0)
51
+ dry-configurable (~> 0.13, >= 0.13.0)
52
+ dry-core (0.7.1)
53
+ concurrent-ruby (~> 1.0)
54
+ dry-inflector (0.2.1)
55
+ dry-initializer (3.1.1)
56
+ dry-logic (1.2.0)
57
+ concurrent-ruby (~> 1.0)
58
+ dry-core (~> 0.5, >= 0.5)
59
+ dry-schema (1.9.3)
60
+ concurrent-ruby (~> 1.0)
61
+ dry-configurable (~> 0.13, >= 0.13.0)
62
+ dry-core (~> 0.5, >= 0.5)
63
+ dry-initializer (~> 3.0)
64
+ dry-logic (~> 1.0)
65
+ dry-types (~> 1.5)
66
+ dry-struct (1.4.0)
67
+ dry-core (~> 0.5, >= 0.5)
68
+ dry-types (~> 1.5)
69
+ ice_nine (~> 0.11)
70
+ dry-types (1.5.1)
71
+ concurrent-ruby (~> 1.0)
72
+ dry-container (~> 0.3)
73
+ dry-core (~> 0.5, >= 0.5)
74
+ dry-inflector (~> 0.1, >= 0.1.2)
75
+ dry-logic (~> 1.0, >= 1.0.2)
76
+ dry-validation (1.8.1)
77
+ concurrent-ruby (~> 1.0)
78
+ dry-container (~> 0.7, >= 0.7.1)
79
+ dry-core (~> 0.5, >= 0.5)
80
+ dry-initializer (~> 3.0)
81
+ dry-schema (~> 1.8, >= 1.8.0)
82
+ faraday (2.7.2)
83
+ faraday-net_http (>= 2.0, < 3.1)
84
+ ruby2_keywords (>= 0.0.4)
85
+ faraday-net_http (3.0.2)
86
+ faraday-net_http_persistent (2.1.0)
87
+ faraday (~> 2.5)
88
+ net-http-persistent (~> 4.0)
89
+ hashdiff (1.0.1)
90
+ httparty (0.21.0)
91
+ mini_mime (>= 1.0.0)
92
+ multi_xml (>= 0.5.2)
93
+ i18n (1.12.0)
94
+ concurrent-ruby (~> 1.0)
95
+ ice_nine (0.11.2)
96
+ method_source (1.0.0)
97
+ mini_mime (1.1.2)
98
+ minitest (5.17.0)
99
+ multi_json (1.15.0)
100
+ multi_xml (0.6.0)
101
+ net-http-persistent (4.0.1)
102
+ connection_pool (~> 2.2)
103
+ nokogiri (1.13.10-x86_64-darwin)
104
+ racc (~> 1.4)
105
+ parallel (1.21.0)
106
+ parser (3.0.3.2)
107
+ ast (~> 2.4.1)
108
+ pry (0.13.1)
109
+ coderay (~> 1.1)
110
+ method_source (~> 1.0)
111
+ public_suffix (4.0.6)
112
+ racc (1.6.2)
113
+ rainbow (3.0.0)
114
+ rake (13.0.6)
115
+ regexp_parser (2.2.0)
116
+ rexml (3.2.5)
117
+ rspec (3.12.0)
118
+ rspec-core (~> 3.12.0)
119
+ rspec-expectations (~> 3.12.0)
120
+ rspec-mocks (~> 3.12.0)
121
+ rspec-core (3.12.0)
122
+ rspec-support (~> 3.12.0)
123
+ rspec-expectations (3.12.1)
124
+ diff-lcs (>= 1.2.0, < 2.0)
125
+ rspec-support (~> 3.12.0)
126
+ rspec-mocks (3.12.1)
127
+ diff-lcs (>= 1.2.0, < 2.0)
128
+ rspec-support (~> 3.12.0)
129
+ rspec-support (3.12.0)
130
+ rubocop (1.23.0)
131
+ parallel (~> 1.10)
132
+ parser (>= 3.0.0.0)
133
+ rainbow (>= 2.2.2, < 4.0)
134
+ regexp_parser (>= 1.8, < 3.0)
135
+ rexml
136
+ rubocop-ast (>= 1.12.0, < 2.0)
137
+ ruby-progressbar (~> 1.7)
138
+ unicode-display_width (>= 1.4.0, < 3.0)
139
+ rubocop-ast (1.15.0)
140
+ parser (>= 3.0.1.1)
141
+ ruby-progressbar (1.11.0)
142
+ ruby2_keywords (0.0.5)
143
+ simplecov (0.21.2)
144
+ docile (~> 1.1)
145
+ simplecov-html (~> 0.11)
146
+ simplecov_json_formatter (~> 0.1)
147
+ simplecov-html (0.12.3)
148
+ simplecov_json_formatter (0.1.3)
149
+ thor (1.2.1)
150
+ timecop (0.9.4)
151
+ tzinfo (2.0.5)
152
+ concurrent-ruby (~> 1.0)
153
+ unicode-display_width (2.1.0)
154
+ webmock (3.14.0)
155
+ addressable (>= 2.8.0)
156
+ crack (>= 0.3.2)
157
+ hashdiff (>= 0.4.0, < 2.0.0)
158
+
159
+ PLATFORMS
160
+ ruby
161
+ x86_64-darwin-21
162
+
163
+ DEPENDENCIES
164
+ codecov (~> 0.6.0)
165
+ pry (~> 0.13.1)
166
+ rspec (~> 3.10)
167
+ rubocop (~> 1.7)
168
+ simplecov
169
+ timecop (~> 0.9.4)
170
+ webmock (~> 3.14)
171
+ xxx_rename!
172
+
173
+ BUNDLED WITH
174
+ 2.3.14
data/README.md ADDED
@@ -0,0 +1,319 @@
1
+ # XxxRename
2
+
3
+ ![pipeline](https://github.com/c477y/xxx_rename/actions/workflows/ruby.yml/badge.svg)
4
+
5
+ A gem to rename your porn videos and integrate with your Stash app as a third-
6
+ party scraper.
7
+
8
+ Currently supports the following websites:
9
+
10
+ * [AdultTime](https://www.adulttime.com/)*
11
+ * [Babes](https://www.babes.com)
12
+ * [Blacked](https://www.blacked.com/)
13
+ * [BlackedRaw](https://www.blacked-raw.com/)
14
+ * [Brazzers](https://www.brazzers.com)
15
+ * [Casting Couch](https://castingcouch-x.com)
16
+ * [Dark X](https://www.darkx.com/en)
17
+ * [Digital Playground](https://www.digitalplayground.com)
18
+ * [Elegant Angel](https://www.elegantangel.com/)
19
+ * [Erotica X](https://www.eroticax.com/en)
20
+ * [Evil Angel](https://evilangel.com/)
21
+ * [Exotic4k](https://exotic4k.com)
22
+ * [FantasyHD](https://fantasyhd.com)
23
+ * [GoodPorn](https://goodporn.to/)
24
+ * [Hard X](https://www.hardx.com/en)
25
+ * [Holed](https://holed.com)
26
+ * [Jules Jordan](https://www.julesjordan.com/)
27
+ * [Lubed](https://lubed.com)
28
+ * [Manuel Ferrara](https://manuelferrara.com/)
29
+ * [Mofos](https://www.mofos.com)
30
+ * [My Very First Time](https://myveryfirsttime.com)
31
+ * [NF Busty](https://nfbusty.com/)
32
+ * [Nanny Spy](https://nannyspy.com)
33
+ * [POVd](https://povd.com)
34
+ * [PassionHD](https://passion-hd.com)
35
+ * [Puremature](https://puremature.com)
36
+ * [Reality Kings](https://www.realitykings.com/)
37
+ * [Slayed](https://www.slayed.com/)
38
+ * [SpyFam](https://spyfam.com)
39
+ * [Stash DB](https://stashdb.org/)
40
+ * [Tiny 4k](https://tiny4k.com)
41
+ * [Tushy Raw](https://www.tushyraw.com/)
42
+ * [Tushy](https://www.tushy.com/)
43
+ * [Twistys](https://www.twistys.com)
44
+ * [Vixen](https://www.vixen.com/)
45
+ * [X Empire](https://www.xempire.com/en)
46
+ * [Wicked](https://www.wicked.com/)
47
+ * [Zero Tolerance Films](https://www.zerotolerancefilms.com/en/?s=1)
48
+
49
+ ![output](./output.png)
50
+
51
+ ## Installation
52
+
53
+ ```shell
54
+ gem install xxx_rename
55
+ ```
56
+
57
+ ### Usage
58
+
59
+ #### Basic Usage
60
+
61
+ ```shell
62
+ $ xxx_rename help
63
+
64
+ Commands:
65
+ xxx_rename generate FILE|FOLDER # Rename a file or all file(s) inside a given directory
66
+ xxx_rename help [COMMAND] # Describe available commands or one specific command
67
+ xxx_rename migrate --version=VERSION # Apply a rename migration file
68
+ xxx_rename rollback --version=VERSION # Rollback a migration
69
+ xxx_rename version # Print the CLI version
70
+ ```
71
+
72
+ #### Generate
73
+
74
+ Generate command scans all files and stores their scraped data inside a file
75
+ stored in the `xxx_rename` config directory. You can add actions that will
76
+ be performed with each successful match:
77
+
78
+ 1. sync_to_stash : Sync the matched details to your Stash App. This will create
79
+ a movie as well on Stash if the scene belongs to a movie (which is something
80
+ that Stash does not do at the moment.)
81
+ 2. log_rename_op : Create a migration file that logs a file with its new
82
+ filename. Migrations are reversible operations that rename all files that
83
+ are matched by xxx_rename.
84
+
85
+ ```shell
86
+ $ xxx_rename help generate
87
+
88
+ Usage:
89
+ xxx_rename generate FILE|FOLDER
90
+
91
+ Options:
92
+ [--config=CONFIG] # path to config file
93
+ [--verbose], [--no-verbose] # enable verbose logging
94
+ [--override-site=OVERRIDE_SITE] # force use an override site
95
+ # Possible values: adult_time, babes, blacked, blacked_raw, brazzers, digital_playground, elegant_angel, evil_angel, goodporn, jules_jordan, manuel_ferrara, mofos, naughty_america, nf_busty, reality_kings, stash, tushy, tushy_raw, twistys, vixen, whale_media, wicked, x_empire, zero_tolerance
96
+ [--nested], [--no-nested] # recursively search for all files in the given directory
97
+ [--force-refresh-datastore], [--no-force-refresh-datastore] # force site client to fetch all scenes, if implemented
98
+ [--actions=ACTIONS] # action to perform on a successful match
99
+ # Possible values: sync_to_stash, log_rename_op
100
+ [--force-refresh], [--no-force-refresh] # force match scenes from original sites
101
+ [--checkpoint=CHECKPOINT] # skip all iterations until check-pointed file is matched
102
+
103
+ Description:
104
+ Scan files and generate metadata
105
+ For first time users, run the command without any flags to generate a config file in $HOME/.config/xxx_rename
106
+
107
+ $ xxx_rename generate
108
+
109
+ The cli will look for a config file in these three places in order:
110
+ * --config (This takes precedence over everything)
111
+ * $HOME/.config/xxx_rename
112
+ * HOME/xxx_rename
113
+
114
+ Examples
115
+ # Scan all files in a given directory and its sub-directories
116
+ $ xxx_rename generate . --nested
117
+
118
+ # Force the cli to use `brazzers` to match a file
119
+ $ xxx_rename generate . --verbose --override_site=brazzers
120
+
121
+ # Generate a migrations file to rename the matched files
122
+ $ xxx_rename generate . --actions=log_rename_op
123
+ ```
124
+
125
+ #### Migrate
126
+
127
+ ```bash
128
+ $ xxx_rename help migrate
129
+
130
+ Usage:
131
+ xxx_rename migrate --version=VERSION
132
+
133
+ Options:
134
+ [--config=CONFIG] # path to config file
135
+ [--version=VERSION] # Name of migration file to apply
136
+ # Default: latest
137
+
138
+ Description:
139
+ WARNING: This is a destructive operation as it will rename files Run this on a small subset to be sure and run it at your own risk
140
+
141
+ Rename files based on operations listed in a migration file.
142
+
143
+ All rename files are located in your `generated_files_dir` directory. Migration files are plain YAML files of format 'output_YYYYMMDDHHMM.yml'
144
+
145
+ Pass a migration file using option `--version YYYYMMDDHHMM`.
146
+ If you want to apply a migration file that you have just created, pass the --version as "latest". Or don't pass the --version flag and the CLI will use the latest version by default.
147
+
148
+ Migration files have the following format:
149
+
150
+ -
151
+ --- # 0 means the migration is not applied
152
+ # 1 means the migration is applied
153
+ # This flag prevents applying a migration that has already been applied
154
+ ___MIGRATION_STATUS___: 0
155
+ # All operations are stored as an array
156
+ ___RENAME_ACTIONS___:
157
+ # DO NOT MANIPULATE AN ARRAY ITEM! Doing so can result in unexpected
158
+ # behaviour. You can remove an operation from the list entirely, but
159
+ # the recommended way is to discard this migration completely,
160
+ # modify the `output_format` for your file in the config and run the
161
+ # generate command again
162
+ - !ruby/object:XxxRename::Data::FileRenameOp
163
+ attributes:
164
+ :key: eab204175567d39202c1df5895e443be # DO NOT MODIFY THIS
165
+ :directory: "/ABSOLUTE/DIRECTORY/TOFILE"
166
+ :source_filename: ORIGINAL_FILENAME.MP4
167
+ :output_filename: NEW_FILENAME.MP4
168
+ :mtime: 2000-01-01 00:00:00.000000000 +00:00
169
+
170
+ Example Usage:
171
+
172
+ $ xxx_rename migrate --version=202301131252
173
+
174
+ $ xxx_rename migrate
175
+ ```
176
+
177
+ #### Rollback
178
+
179
+ ```bash
180
+ $ xxx_rename help rollback
181
+
182
+ Usage:
183
+ xxx_rename rollback --version=VERSION
184
+
185
+ Options:
186
+ [--config=CONFIG] # path to config file
187
+ [--version=VERSION] # Name of migration file to apply
188
+ # Default: latest
189
+
190
+ Description:
191
+ Reverse the actions taken by the `migrate` command
192
+
193
+ Read the help command for more information
194
+
195
+ $ xxx_rename help migrate
196
+ ```
197
+
198
+ ## FAQs
199
+
200
+ ### How does this work?
201
+
202
+ xxx_rename works assumes all files are a scene. Each scene can be matched by one
203
+ (or more) site client (a site that will be scraped to fetch details). For some
204
+ files that are downloaded from original sources (at this time these are mg
205
+ premium sites brazzers along with evil angel, goodporn, NF busty and vixen
206
+ media), xxx_rename will try to guess the site client based on the unique format
207
+ of the filename themselves.
208
+
209
+ In other case, you are required to define these rules yourself in the config
210
+ file. Rules are just string of tokens that generate a regex to match a file. For
211
+ example, let's say you have a file like this "[EvilAngel] Blake Blossom - Facial
212
+ Fantasy 3.mp4". You can create a rule in your config file like this:
213
+
214
+ ```yml
215
+ evil_angel:
216
+ file_source_format:
217
+ # Notice the missing .ext in the pattern
218
+ - "[EvilAngel] %female_actors - %title"
219
+ ```
220
+
221
+ Now, when you run the `generate` command, xxx_rename will look at the rules and
222
+ match the file with evil_angel. It will then use the %title(Facial Fantasy 3)
223
+ and %female_actors([Blake Blossom]) data and search EvilAngel for a scene that
224
+ matches the parsed details from a file. This will *near guarantee* that the
225
+ match will be correct (which can be an issue with other tools like
226
+ [stash-box](https://stashdb.org/) or
227
+ [metadataapi.net](https://metadataapi.net/)).
228
+
229
+ ### What are `collection_tags` in the config?
230
+
231
+ Think of `collection_tag` as reserved keywords. `collection_tags` are three
232
+ character unique keywords that are used to associate a file with a site client.
233
+ The CLI expects all filenames to have a unique format, which can be a problem
234
+ when all files are renamed using a common format. `collection_tags` introduce
235
+ just enough uniqueness in the filename to allow `xxx_rename` associate them with
236
+ a site client.
237
+
238
+ ### What are the supported tokens
239
+
240
+ | Token | Regex | Description |
241
+ | ----------------- | ------------------------------------------------------------- | ------------------------------------------------------------------ |
242
+ | %title | (?&lt;title>[\\w\\s\\-_,'\"\\.]+) | Title of the scene |
243
+ | %collection | (?&lt;collection>[\\w\\s\\-_,'\"\\.]+) | Usually the studio |
244
+ | %collection_op | (?&lt;collection>[\\w\\s\\-_,'\"]*?) | Same as collection, but allows optional values |
245
+ | %collection_tag_1 | (?&lt;collection_tag>\\w) | A single character reserved word |
246
+ | %collection_tag_2 | (?&lt;collection_tag>\\w{,2}) | Two character reserved word |
247
+ | %collection_tag_3 | (?&lt;collection_tag>\\w{,3}) | Three character reserved word |
248
+ | %female_actors | (?&lt;female_actors>[\\w\\s\\-_,'\"\\.]+) | Comma Separated list of names |
249
+ | %male_actors | (?&lt;male_actors>[\\w\\s\\-_,'\"\\.]+) | Comma Separated list of names |
250
+ | %male_actors_op | (?&lt;male_actors>[\\w\\s\\-_,'\"]*)? | Same as %male_actors, but optional |
251
+ | %actors | (?&lt;actors>[\\w\\s\\-_,'\"\\.]+) | Use if there's no obvious separator between male and female actors |
252
+ | %id | (?&lt;id>(\\d+\|[a-z\\-\\_]+)) | Unique ID |
253
+ | %id_op | (?&lt;id>(\\d*\|[a-z\\-\\_]*))? | Same as ID, but optional |
254
+ | %ignore_1_word | (\\w\\s){1} | Ignore a filler word |
255
+ | %ignore_2_words | (\\w\\s){2} | Ignore 2 filler word |
256
+ | %ignore_3_words | (\\w\\s){3} | Ignore 3 filler words |
257
+ | %ignore_4_words | (\\w\\s){4} | Ignore 4 filler words |
258
+ | %ignore_5_words | (\\w\\s){5} | Ignore 5 filler words |
259
+ | %ignore_6_words | (\\w\\s){6} | Ignore 6 filler words |
260
+ | %ignore_7_words | (\\w\\s){7} | Ignore 7 filler words |
261
+ | %ignore_all | ".* | Ignore everything |
262
+ | %yyyy_mm_dd | (?&lt;year>\\d{4})\_(?&lt;month>\\d{1,2})_(?&lt;day>\\d{1,2}) | Complete year in YYYY_MM_DD for |
263
+ | %dd | (?&lt;day>\\d{1,2}) | DD (Day of Month) |
264
+ | %mm | (?&lt;month>\\d{1,2}) | MM (Month of Year) |
265
+ | %yyyy | (?&lt;year>\\d{4}) | YYYY (Year) |
266
+ | %yy | (?&lt;year>\\d{2,4}) | YY (Compressed Year) |
267
+
268
+ ### How does xxx_rename compare with Stash DB?
269
+
270
+ xxx_rename can be considered an extension to
271
+ [Stash](https://github.com/stashapp/stash). It does not intend to compete with
272
+ the sheer number of features provided by Stash. In fact, stash-box is considered
273
+ a valid `site client` if you want to use it. Stash DB's matches are pretty
274
+ accurate given their community contribution and phash matching algorithm.
275
+ But I also realise stash is an overkill for a lot of people. For someone who
276
+ has a casual collection and just want to organize their files with meaningful
277
+ names (compared with obfuscated names some sites use for their original files),
278
+ xxx_rename works beautifully and serves their purpose well.
279
+
280
+ You choose how you want your files to be renamed and what data you like and what
281
+ you don't. Change your mind in the future? No problem, xxx_rename remembers all
282
+ scenes and you can choose a new format anytime you want.
283
+
284
+ ### How does xxx_rename compare with namer?
285
+
286
+ [namer](https://github.com/ThePornDatabase/namer) works on a similar principle
287
+ as xxx_rename, in which it also uses regexes to fetch metadata from a filename.
288
+ But it matches a search using its own database
289
+ [metadataapi.net](https://metadataapi.net). While the tool is really amazing and
290
+ requires little configuration from the user, it results in mismatches and you
291
+ can end up with a filename that is simply incorrect.
292
+
293
+ xxx_rename works on the principle of BYOD (Bring Your Own Data). All search
294
+ happens locally, there are no external servers, no tracking whatsoever and you
295
+ own your database. Since there's a certain configuration required from your
296
+ side, there are little chances for any errors. xxx_rename is not a swiss knife
297
+ of all scrapers, it prefers correctness over convenience.
298
+
299
+ ### Why is Site X not supported?
300
+
301
+ Some websites are really stubborn as they do not provide a basic search
302
+ facility. The biggest example of this is Naughty America, which has been a paid
303
+ to find a workaround and implement from scratch. Some websites lock their search
304
+ behind a paywall(membership), so while it's possible for me to implement a
305
+ search functionality, it is impossible to test and maintain once the membership
306
+ period is over.
307
+
308
+ ### What sites can be supported?
309
+
310
+ Any site that provide a meaningful filename and have a usable API/website. Raise
311
+ a request on the [issues](https://github.com/c477y/xxx_rename/issues) page with
312
+ the name of the website you want to get support for and a list of original
313
+ filenames (not the actual files). I can't promise if I will be able to implement
314
+ it but the request will be open for someone in the community to integrate.
315
+
316
+ ## Contribution
317
+
318
+ Pull requests are welcome! See [Development](docs/DEVELOPMENT.md) for setup
319
+ instructions.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]