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