2022-03-02 22:13:28 +01:00
|
|
|
|
using System.Collections.Generic;
|
2022-02-26 14:32:34 +01:00
|
|
|
|
using VDownload.Core.Enums;
|
2022-02-16 03:15:41 +01:00
|
|
|
|
using Windows.Media.Editing;
|
2022-03-07 14:59:11 +01:00
|
|
|
|
using Windows.Media.Transcoding;
|
2022-02-16 03:15:41 +01:00
|
|
|
|
using Windows.Storage;
|
|
|
|
|
|
|
|
|
|
|
|
namespace VDownload.Core.Services
|
|
|
|
|
|
{
|
2022-02-19 01:38:37 +01:00
|
|
|
|
public class Config
|
2022-02-16 03:15:41 +01:00
|
|
|
|
{
|
|
|
|
|
|
#region CONSTANTS
|
|
|
|
|
|
|
|
|
|
|
|
// SETTINGS CONTAINER
|
|
|
|
|
|
private static readonly ApplicationDataContainer SettingsContainer = ApplicationData.Current.LocalSettings;
|
|
|
|
|
|
|
|
|
|
|
|
// DEFAULT SETTINGS
|
|
|
|
|
|
private static readonly Dictionary<string, object> DefaultSettings = new Dictionary<string, object>()
|
|
|
|
|
|
{
|
|
|
|
|
|
{ "delete_temp_on_start", true },
|
|
|
|
|
|
{ "twitch_vod_passive_trim", true },
|
2022-03-03 00:34:52 +01:00
|
|
|
|
{ "twitch_vod_downloading_chunk_retry_after_error", false },
|
2022-02-16 03:15:41 +01:00
|
|
|
|
{ "twitch_vod_downloading_chunk_max_retries", 10 },
|
|
|
|
|
|
{ "twitch_vod_downloading_chunk_retries_delay", 5000 },
|
|
|
|
|
|
{ "media_transcoding_use_hardware_acceleration", true },
|
2022-03-07 14:59:11 +01:00
|
|
|
|
{ "media_transcoding_algorithm", (int)MediaVideoProcessingAlgorithm.MrfCrf444 },
|
2022-02-19 01:38:37 +01:00
|
|
|
|
{ "media_editing_algorithm", (int)MediaTrimmingPreference.Fast },
|
|
|
|
|
|
{ "default_max_playlist_videos", 0 },
|
2022-02-26 14:32:34 +01:00
|
|
|
|
{ "default_media_type", (int)MediaType.AudioVideo },
|
|
|
|
|
|
{ "default_filename", "[<date_pub:yyyy.MM.dd>] <title>" },
|
|
|
|
|
|
{ "default_video_extension", (int)VideoFileExtension.MP4 },
|
|
|
|
|
|
{ "default_audio_extension", (int)AudioFileExtension.MP3 },
|
2022-02-28 13:31:58 +01:00
|
|
|
|
{ "custom_media_location", false },
|
|
|
|
|
|
{ "custom_temp_location", false },
|
|
|
|
|
|
{ "max_active_video_task", 5 },
|
|
|
|
|
|
{ "replace_output_file_if_exists", false },
|
2022-03-03 00:34:52 +01:00
|
|
|
|
{ "remove_task_when_successfully_ended", false },
|
|
|
|
|
|
{ "delete_task_temp_when_ended_with_error", false },
|
|
|
|
|
|
{ "show_notification_when_task_ended_successfully", false },
|
2022-03-03 21:16:39 +01:00
|
|
|
|
{ "show_notification_when_task_ended_unsuccessfully", false },
|
|
|
|
|
|
{ "show_warning_when_task_starts_on_metered_network", true },
|
|
|
|
|
|
{ "delay_task_when_queued_task_starts_on_metered_network", true }
|
2022-02-16 03:15:41 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region METHODS
|
|
|
|
|
|
|
|
|
|
|
|
// GET VALUE
|
|
|
|
|
|
public static object GetValue(string key)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SettingsContainer.Values[key];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SET VALUE
|
|
|
|
|
|
public static void SetValue(string key, object value)
|
|
|
|
|
|
{
|
|
|
|
|
|
SettingsContainer.Values[key] = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// SET DEFAULT
|
|
|
|
|
|
public static void SetDefault()
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (KeyValuePair<string, object> s in DefaultSettings)
|
|
|
|
|
|
{
|
|
|
|
|
|
SettingsContainer.Values[s.Key] = s.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// REBUILD
|
|
|
|
|
|
public static void Rebuild()
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (KeyValuePair<string, object> s in DefaultSettings)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!SettingsContainer.Values.ContainsKey(s.Key))
|
|
|
|
|
|
{
|
|
|
|
|
|
SettingsContainer.Values[s.Key] = s.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|