Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Group files by other attributes #140

Open
fmajestic opened this issue Mar 10, 2024 · 1 comment
Open

[FEATURE] Group files by other attributes #140

fmajestic opened this issue Mar 10, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@fmajestic
Copy link

Is your feature request related to a problem? Please describe.
I'd like to group files by Download Date. Currently, only Account is supported.

Describe the solution you'd like
Add more options to the Group Files dropdown.
Ideally it would include everything from Filename Pattern (except Serial).

Describe alternatives you've considered
A shell script for manually moving files into directories.

Additional context
I'd be interested in developing this, if you're OK with adding the feature.

@fmajestic fmajestic added the enhancement New feature or request label Mar 10, 2024
@EltonChou
Copy link
Owner

EltonChou commented Mar 11, 2024

Here are some entry points good to start.
The tokens should be organized as enum.

type AggregationToken = '{account}'

makeAggregationDirectory(tweetDetail: TweetDetail): string {
switch (this.settings.groupBy) {
case '{account}':
return tweetDetail.screenName
default:
return tweetDetail.screenName
}
}

<RichFeatureSwitch
name={i18n('options_general_fileAggregation')}
desc={i18n('options_general_fileAggregation_desc')}
isOn={filenameSettings.fileAggregation}
handleClick={formHandler.aggregationToggle}
cursor="pointer"
>
<Select
isDisabled={!filenameSettings.fileAggregation}
onChange={formHandler.aggregationToggle}
>
<option value="{account}">
{i18n('options_general_filenamePattern_token_account')}
</option>
</Select>
</RichFeatureSwitch>

function settingReducer(
settings: V4FilenameSettings,
action: FilenameSettingsAction
): V4FilenameSettings {
switch (action.type) {
case 'toggleDirectory':
return { ...settings, noSubDirectory: !settings.noSubDirectory }
case 'toggleFileAggregation':
return { ...settings, fileAggregation: !settings.fileAggregation }
case 'setDirectory':
return { ...settings, directory: action.payload }
case 'setFilenamePattern':
return { ...settings, filenamePattern: action.payload }
case 'setAggregationToken':
return { ...settings, groupBy: action.payload }
case 'init':
return action.payload
case 'reset':
return defaultFilenameSettings
default:
throw new Error(`Unknown action: ${action}`)
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants