reelsort 0.1.1 → 0.2.0

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.
@@ -0,0 +1,222 @@
1
+ interface CleanOptions {
2
+ dryRun?: boolean;
3
+ olderThan?: string;
4
+ emptyFolders?: boolean;
5
+ }
6
+ declare const clean: ({ dryRun, olderThan }: CleanOptions) => Promise<void>;
7
+
8
+ interface SourceAddOptions {
9
+ dir: string;
10
+ }
11
+ interface SourceRemoveOptions {
12
+ dir: string;
13
+ }
14
+ interface DestAddOptions {
15
+ type: string;
16
+ dir: string;
17
+ }
18
+ interface DestRemoveOptions {
19
+ type: string;
20
+ }
21
+ interface ConfigSetOptions {
22
+ key: string;
23
+ subkey: string;
24
+ value?: string;
25
+ }
26
+ interface ConfigShowOptions {
27
+ [key: string]: unknown;
28
+ }
29
+ declare const sourceAdd: ({ dir }: SourceAddOptions) => Promise<void>;
30
+ declare const sourceRemove: ({ dir }: SourceRemoveOptions) => Promise<void>;
31
+ declare const destAdd: ({ type, dir }: DestAddOptions) => Promise<void>;
32
+ declare const destRemove: ({ type }: DestRemoveOptions) => Promise<void>;
33
+ declare const configSet: ({ key, subkey, value }: ConfigSetOptions) => Promise<void>;
34
+ declare const configShow: () => Promise<void>;
35
+
36
+ interface DifferencesOptions {
37
+ dir1: string;
38
+ dir2: string;
39
+ ignore?: string[];
40
+ only?: string[];
41
+ }
42
+ declare const differences: ({ dir1: rawDir1, dir2: rawDir2, only, ignore }: DifferencesOptions) => Promise<void>;
43
+
44
+ interface HistoryOptions {
45
+ limit?: number;
46
+ imports?: boolean;
47
+ }
48
+ declare const history: ({ limit, imports }: HistoryOptions) => Promise<void>;
49
+
50
+ interface ListOptions {
51
+ type?: 'movie' | 'tv' | 'ps3';
52
+ missingSubs?: boolean;
53
+ codec?: string;
54
+ resolution?: string;
55
+ sort?: string;
56
+ }
57
+ declare const list: ({ type, missingSubs, codec: codecFilter, resolution: resFilter, sort }: ListOptions) => Promise<void>;
58
+
59
+ interface ProbeOptions {
60
+ type?: 'movie' | 'tv' | 'ps3';
61
+ force?: boolean;
62
+ verbose?: boolean;
63
+ }
64
+ declare const probe: ({ type, force, verbose }: ProbeOptions) => Promise<void>;
65
+
66
+ interface RenameOptions {
67
+ dir: string;
68
+ type?: 'movie' | 'tv' | 'ps3';
69
+ verbose?: boolean;
70
+ }
71
+ declare const rename: ({ dir: inputDir, type, verbose }: RenameOptions) => Promise<void>;
72
+
73
+ interface ResetOptions {
74
+ dir: string;
75
+ double?: boolean;
76
+ }
77
+ declare const reset: ({ dir: inputDir, double }: ResetOptions) => Promise<void>;
78
+
79
+ interface ScanOptions {
80
+ type?: 'movie' | 'tv' | 'ps3';
81
+ hardlink?: boolean;
82
+ dryRun?: boolean;
83
+ verbose?: boolean;
84
+ auto?: boolean;
85
+ }
86
+ declare const scan: ({ type, hardlink: useHardlink, dryRun, verbose, auto }: ScanOptions) => Promise<void>;
87
+
88
+ declare const undo: () => Promise<void>;
89
+
90
+ interface WatchOptions {
91
+ hardlink?: boolean;
92
+ verbose?: boolean;
93
+ auto?: boolean;
94
+ }
95
+ declare const watch: ({ hardlink, verbose, auto }: WatchOptions) => Promise<void>;
96
+
97
+ interface ReelSortConfig {
98
+ sources: string[];
99
+ dest: {
100
+ movie?: string;
101
+ tv?: string;
102
+ ps3?: string;
103
+ };
104
+ language?: string;
105
+ tmdbApiKey?: string;
106
+ format?: {
107
+ movie?: string;
108
+ episode?: string;
109
+ season?: string;
110
+ };
111
+ }
112
+ declare const getConfig: () => ReelSortConfig;
113
+ declare const saveConfig: (config: ReelSortConfig) => void;
114
+
115
+ interface RenameRecord {
116
+ id: number;
117
+ sessionId: string;
118
+ oldPath: string;
119
+ newPath: string;
120
+ renamedAt: string;
121
+ }
122
+ declare const recordRename: (sessionId: string, oldPath: string, newPath: string) => void;
123
+ declare const getLastSession: () => RenameRecord[];
124
+ declare const deleteSession: (sessionId: string) => void;
125
+ interface RenameSession {
126
+ sessionId: string;
127
+ records: RenameRecord[];
128
+ }
129
+ type ImportMode = 'move' | 'hardlink' | 'copy';
130
+ interface ImportRecord {
131
+ id: number;
132
+ sessionId: string;
133
+ sourcePath: string;
134
+ destinationPath: string;
135
+ mode: ImportMode;
136
+ tmdbId: number | null;
137
+ importedAt: string;
138
+ }
139
+ declare const recordImport: (sessionId: string, sourcePath: string, destPath: string, mode: ImportMode, tmdbId?: number) => void;
140
+ interface MediaInfoRecord {
141
+ id: number;
142
+ filePath: string;
143
+ codec: string | null;
144
+ resolution: string | null;
145
+ width: number | null;
146
+ height: number | null;
147
+ duration: number | null;
148
+ probedAt: string;
149
+ }
150
+ declare const getMediaInfo: (filePath: string) => MediaInfoRecord | null;
151
+ declare const upsertMediaInfo: (filePath: string, codec: string | null, resolution: string | null, width: number | null, height: number | null, duration: number | null) => void;
152
+ declare const getImportByDest: (destPath: string) => ImportRecord | null;
153
+ declare const getCleanableImports: () => ImportRecord[];
154
+ declare const deleteImport: (id: number) => void;
155
+ declare const getHistory: (limit?: number) => RenameSession[];
156
+
157
+ declare const detectEdition: (filename: string) => string | null;
158
+
159
+ declare const DEFAULT_EPISODE_FORMAT = "{s}x{ee}";
160
+ declare const DEFAULT_SEASON_FORMAT = "Season {s}";
161
+ declare const formatSeasonFolder: (format: string, season: number) => string;
162
+ declare const formatEpisode: (season: number, episode: number, format?: string, double?: boolean, title?: string, name?: string) => string;
163
+
164
+ declare const DEFAULT_MOVIE_FORMAT = "{title} ({year})";
165
+ declare const formatMovieName: (template: string, title: string, year?: number, edition?: string | null) => string;
166
+
167
+ interface ParsedMediaName {
168
+ title: string;
169
+ year?: number;
170
+ type: 'movie' | 'tv';
171
+ season?: number;
172
+ episode?: number;
173
+ }
174
+ declare const parseDownloadName: (name: string) => ParsedMediaName | null;
175
+
176
+ interface Quality {
177
+ resolution?: string;
178
+ codec?: string;
179
+ }
180
+ declare const parseQuality: (filename: string) => Quality;
181
+ declare const normalizeResolution: (s: string) => string;
182
+ declare const normalizeCodec: (s: string) => string;
183
+
184
+ declare const _default: (s: string) => string;
185
+
186
+ var videoExtensions = [
187
+ "3g2",
188
+ "3gp",
189
+ "aaf",
190
+ "asf",
191
+ "avchd",
192
+ "avi",
193
+ "drc",
194
+ "flv",
195
+ "m2v",
196
+ "m4p",
197
+ "m4v",
198
+ "mkv",
199
+ "mng",
200
+ "mov",
201
+ "mp2",
202
+ "mp4",
203
+ "mpe",
204
+ "mpeg",
205
+ "mpg",
206
+ "mpv",
207
+ "mxf",
208
+ "nsv",
209
+ "ogg",
210
+ "ogv",
211
+ "qt",
212
+ "rm",
213
+ "rmvb",
214
+ "roq",
215
+ "svi",
216
+ "vob",
217
+ "webm",
218
+ "wmv",
219
+ "yuv"
220
+ ];
221
+
222
+ export { type CleanOptions, type ConfigSetOptions, type ConfigShowOptions, DEFAULT_EPISODE_FORMAT, DEFAULT_MOVIE_FORMAT, DEFAULT_SEASON_FORMAT, type DestAddOptions, type DestRemoveOptions, type DifferencesOptions, type HistoryOptions, type ImportMode, type ImportRecord, type ListOptions, type MediaInfoRecord, type ParsedMediaName, type ProbeOptions, type Quality, type ReelSortConfig, type RenameOptions, type RenameRecord, type RenameSession, type ResetOptions, type ScanOptions, type SourceAddOptions, type SourceRemoveOptions, type WatchOptions, clean, configSet, configShow, deleteImport, deleteSession, destAdd, destRemove, detectEdition, differences, formatEpisode, formatMovieName, formatSeasonFolder, getCleanableImports, getConfig, getHistory, getImportByDest, getLastSession, getMediaInfo, history, list, normalizeCodec, normalizeResolution, parseDownloadName, parseQuality, probe, recordImport, recordRename, rename, reset, saveConfig, scan, sourceAdd, sourceRemove, _default as titleCase, undo, upsertMediaInfo, videoExtensions, watch };
@@ -0,0 +1,222 @@
1
+ interface CleanOptions {
2
+ dryRun?: boolean;
3
+ olderThan?: string;
4
+ emptyFolders?: boolean;
5
+ }
6
+ declare const clean: ({ dryRun, olderThan }: CleanOptions) => Promise<void>;
7
+
8
+ interface SourceAddOptions {
9
+ dir: string;
10
+ }
11
+ interface SourceRemoveOptions {
12
+ dir: string;
13
+ }
14
+ interface DestAddOptions {
15
+ type: string;
16
+ dir: string;
17
+ }
18
+ interface DestRemoveOptions {
19
+ type: string;
20
+ }
21
+ interface ConfigSetOptions {
22
+ key: string;
23
+ subkey: string;
24
+ value?: string;
25
+ }
26
+ interface ConfigShowOptions {
27
+ [key: string]: unknown;
28
+ }
29
+ declare const sourceAdd: ({ dir }: SourceAddOptions) => Promise<void>;
30
+ declare const sourceRemove: ({ dir }: SourceRemoveOptions) => Promise<void>;
31
+ declare const destAdd: ({ type, dir }: DestAddOptions) => Promise<void>;
32
+ declare const destRemove: ({ type }: DestRemoveOptions) => Promise<void>;
33
+ declare const configSet: ({ key, subkey, value }: ConfigSetOptions) => Promise<void>;
34
+ declare const configShow: () => Promise<void>;
35
+
36
+ interface DifferencesOptions {
37
+ dir1: string;
38
+ dir2: string;
39
+ ignore?: string[];
40
+ only?: string[];
41
+ }
42
+ declare const differences: ({ dir1: rawDir1, dir2: rawDir2, only, ignore }: DifferencesOptions) => Promise<void>;
43
+
44
+ interface HistoryOptions {
45
+ limit?: number;
46
+ imports?: boolean;
47
+ }
48
+ declare const history: ({ limit, imports }: HistoryOptions) => Promise<void>;
49
+
50
+ interface ListOptions {
51
+ type?: 'movie' | 'tv' | 'ps3';
52
+ missingSubs?: boolean;
53
+ codec?: string;
54
+ resolution?: string;
55
+ sort?: string;
56
+ }
57
+ declare const list: ({ type, missingSubs, codec: codecFilter, resolution: resFilter, sort }: ListOptions) => Promise<void>;
58
+
59
+ interface ProbeOptions {
60
+ type?: 'movie' | 'tv' | 'ps3';
61
+ force?: boolean;
62
+ verbose?: boolean;
63
+ }
64
+ declare const probe: ({ type, force, verbose }: ProbeOptions) => Promise<void>;
65
+
66
+ interface RenameOptions {
67
+ dir: string;
68
+ type?: 'movie' | 'tv' | 'ps3';
69
+ verbose?: boolean;
70
+ }
71
+ declare const rename: ({ dir: inputDir, type, verbose }: RenameOptions) => Promise<void>;
72
+
73
+ interface ResetOptions {
74
+ dir: string;
75
+ double?: boolean;
76
+ }
77
+ declare const reset: ({ dir: inputDir, double }: ResetOptions) => Promise<void>;
78
+
79
+ interface ScanOptions {
80
+ type?: 'movie' | 'tv' | 'ps3';
81
+ hardlink?: boolean;
82
+ dryRun?: boolean;
83
+ verbose?: boolean;
84
+ auto?: boolean;
85
+ }
86
+ declare const scan: ({ type, hardlink: useHardlink, dryRun, verbose, auto }: ScanOptions) => Promise<void>;
87
+
88
+ declare const undo: () => Promise<void>;
89
+
90
+ interface WatchOptions {
91
+ hardlink?: boolean;
92
+ verbose?: boolean;
93
+ auto?: boolean;
94
+ }
95
+ declare const watch: ({ hardlink, verbose, auto }: WatchOptions) => Promise<void>;
96
+
97
+ interface ReelSortConfig {
98
+ sources: string[];
99
+ dest: {
100
+ movie?: string;
101
+ tv?: string;
102
+ ps3?: string;
103
+ };
104
+ language?: string;
105
+ tmdbApiKey?: string;
106
+ format?: {
107
+ movie?: string;
108
+ episode?: string;
109
+ season?: string;
110
+ };
111
+ }
112
+ declare const getConfig: () => ReelSortConfig;
113
+ declare const saveConfig: (config: ReelSortConfig) => void;
114
+
115
+ interface RenameRecord {
116
+ id: number;
117
+ sessionId: string;
118
+ oldPath: string;
119
+ newPath: string;
120
+ renamedAt: string;
121
+ }
122
+ declare const recordRename: (sessionId: string, oldPath: string, newPath: string) => void;
123
+ declare const getLastSession: () => RenameRecord[];
124
+ declare const deleteSession: (sessionId: string) => void;
125
+ interface RenameSession {
126
+ sessionId: string;
127
+ records: RenameRecord[];
128
+ }
129
+ type ImportMode = 'move' | 'hardlink' | 'copy';
130
+ interface ImportRecord {
131
+ id: number;
132
+ sessionId: string;
133
+ sourcePath: string;
134
+ destinationPath: string;
135
+ mode: ImportMode;
136
+ tmdbId: number | null;
137
+ importedAt: string;
138
+ }
139
+ declare const recordImport: (sessionId: string, sourcePath: string, destPath: string, mode: ImportMode, tmdbId?: number) => void;
140
+ interface MediaInfoRecord {
141
+ id: number;
142
+ filePath: string;
143
+ codec: string | null;
144
+ resolution: string | null;
145
+ width: number | null;
146
+ height: number | null;
147
+ duration: number | null;
148
+ probedAt: string;
149
+ }
150
+ declare const getMediaInfo: (filePath: string) => MediaInfoRecord | null;
151
+ declare const upsertMediaInfo: (filePath: string, codec: string | null, resolution: string | null, width: number | null, height: number | null, duration: number | null) => void;
152
+ declare const getImportByDest: (destPath: string) => ImportRecord | null;
153
+ declare const getCleanableImports: () => ImportRecord[];
154
+ declare const deleteImport: (id: number) => void;
155
+ declare const getHistory: (limit?: number) => RenameSession[];
156
+
157
+ declare const detectEdition: (filename: string) => string | null;
158
+
159
+ declare const DEFAULT_EPISODE_FORMAT = "{s}x{ee}";
160
+ declare const DEFAULT_SEASON_FORMAT = "Season {s}";
161
+ declare const formatSeasonFolder: (format: string, season: number) => string;
162
+ declare const formatEpisode: (season: number, episode: number, format?: string, double?: boolean, title?: string, name?: string) => string;
163
+
164
+ declare const DEFAULT_MOVIE_FORMAT = "{title} ({year})";
165
+ declare const formatMovieName: (template: string, title: string, year?: number, edition?: string | null) => string;
166
+
167
+ interface ParsedMediaName {
168
+ title: string;
169
+ year?: number;
170
+ type: 'movie' | 'tv';
171
+ season?: number;
172
+ episode?: number;
173
+ }
174
+ declare const parseDownloadName: (name: string) => ParsedMediaName | null;
175
+
176
+ interface Quality {
177
+ resolution?: string;
178
+ codec?: string;
179
+ }
180
+ declare const parseQuality: (filename: string) => Quality;
181
+ declare const normalizeResolution: (s: string) => string;
182
+ declare const normalizeCodec: (s: string) => string;
183
+
184
+ declare const _default: (s: string) => string;
185
+
186
+ var videoExtensions = [
187
+ "3g2",
188
+ "3gp",
189
+ "aaf",
190
+ "asf",
191
+ "avchd",
192
+ "avi",
193
+ "drc",
194
+ "flv",
195
+ "m2v",
196
+ "m4p",
197
+ "m4v",
198
+ "mkv",
199
+ "mng",
200
+ "mov",
201
+ "mp2",
202
+ "mp4",
203
+ "mpe",
204
+ "mpeg",
205
+ "mpg",
206
+ "mpv",
207
+ "mxf",
208
+ "nsv",
209
+ "ogg",
210
+ "ogv",
211
+ "qt",
212
+ "rm",
213
+ "rmvb",
214
+ "roq",
215
+ "svi",
216
+ "vob",
217
+ "webm",
218
+ "wmv",
219
+ "yuv"
220
+ ];
221
+
222
+ export { type CleanOptions, type ConfigSetOptions, type ConfigShowOptions, DEFAULT_EPISODE_FORMAT, DEFAULT_MOVIE_FORMAT, DEFAULT_SEASON_FORMAT, type DestAddOptions, type DestRemoveOptions, type DifferencesOptions, type HistoryOptions, type ImportMode, type ImportRecord, type ListOptions, type MediaInfoRecord, type ParsedMediaName, type ProbeOptions, type Quality, type ReelSortConfig, type RenameOptions, type RenameRecord, type RenameSession, type ResetOptions, type ScanOptions, type SourceAddOptions, type SourceRemoveOptions, type WatchOptions, clean, configSet, configShow, deleteImport, deleteSession, destAdd, destRemove, detectEdition, differences, formatEpisode, formatMovieName, formatSeasonFolder, getCleanableImports, getConfig, getHistory, getImportByDest, getLastSession, getMediaInfo, history, list, normalizeCodec, normalizeResolution, parseDownloadName, parseQuality, probe, recordImport, recordRename, rename, reset, saveConfig, scan, sourceAdd, sourceRemove, _default as titleCase, undo, upsertMediaInfo, videoExtensions, watch };