Compare commits

..

No commits in common. "c8dd77878437c111d1bf2cf386ae62d05a526436" and "8ec45ad07cc628dec4bd1f6903c523cd8721c259" have entirely different histories.

4 changed files with 3 additions and 50 deletions

3
.gitignore vendored
View file

@ -543,5 +543,4 @@ FodyWeavers.xsd
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
.idea/**
*.txt
.idea/**

View file

View file

@ -1,11 +1,9 @@
// I hereby waive this project under the public domain - see UNLICENSE for details.
const string banner = "=== Publish Times ===";
var numberOfArticles = 5; // Define how many articles to schedule
var startTime = new TimeSpan(9, 0, 0); // Starting time at 9:00 AM
var random = new Random();
var scheduledTimes = new List<TimeSpan>();
var storeSchedule = new List<String>();
for (int i = 0; i < numberOfArticles; i++)
{
@ -41,46 +39,6 @@ string TimeSpanToAMPM(TimeSpan time)
Console.WriteLine(banner);
foreach (var time in scheduledTimes)
{
var articleTime = $"Article {scheduledTimes.IndexOf(time) + 1} Scheduled at: {TimeSpanToAMPM(time)}";
// Correct format string to display time in 12-hour format with AM/PM
Console.WriteLine(articleTime);
// Store the schedule to memory for option export
storeSchedule.Add(articleTime);
}
// Give the user an option to export the schedule
Console.WriteLine("Export? Y/N");
if (Console.ReadKey().Key == ConsoleKey.Y)
{
var appPath = Directory.GetCurrentDirectory();
var scheduleFile = "schedule.txt";
var filePath = Path.Combine(appPath, scheduleFile);
var appendSchedule = false;
// If the file already exists, assume the schedule was written
if (File.Exists(filePath))
{
Console.WriteLine($"{Environment.NewLine}Add another schedule? Y/N");
if (Console.ReadKey().Key == ConsoleKey.Y)
appendSchedule = true;
}
// Write to file.
using (var outputFile = new StreamWriter(Path.Combine(appPath, scheduleFile), appendSchedule))
{
// Add separator between times
if (appendSchedule)
outputFile.WriteLine(" ---");
foreach (var line in storeSchedule)
outputFile.WriteLine(line);
}
// Clear list and start over
storeSchedule.Clear();
}
else
{
Environment.Exit(Environment.ExitCode);
Console.WriteLine($"Article {scheduledTimes.IndexOf(time) + 1} Scheduled at: {TimeSpanToAMPM(time)}");
}

View file

@ -1,10 +1,6 @@
# Publish Times
This is a very simple console application that generates a list of times to schedule news with a 2-3 hour delay and a 30 minute time gap per-article.
## Background
A while back, I [found a tool](https://schedule.lemmings.world) to schedule articles on Lemmy. I've been posting within a few hour apart at random minutes and I wanted to something decide that for me. I had AI write the algorithm.
This is a very simple console application that generates a list of times to schedule news with a 2-3 hour delay with a 30 minute time gap per-article.
## License