Author SHA1 Message Date
pi-ux-ce d3345fe31d Update Program.cs
Gitea Actions Demo / Explore-Gitea-Actions (8.0.x) (push) Failing after 1m7s
2025-06-09 22:17:09 +00:00
pi-ux-ce 44508acf2b Upload files to "/"
Gitea Actions Demo / Explore-Gitea-Actions (8.0.x) (push) Failing after 1m22s
2025-06-09 17:18:30 +00:00
pi-ux-ce a0124a9313 trying to build with windows
Gitea Actions Demo / Explore-Gitea-Actions (8.0.x) (push) Successful in 2m0s
2024-11-04 21:34:11 +00:00
pi-ux-ce 2dcebb96cb remove bin folder to find the right executable
Gitea Actions Demo / Explore-Gitea-Actions (8.0.x) (push) Failing after 3m26s
2024-11-04 21:25:41 +00:00
pi-ux-ce 90f5d27a16 update kisscartoon URL and therefore test the CI
Gitea Actions Demo / Explore-Gitea-Actions (8.0.x) (push) Successful in 1m41s
2024-11-04 17:57:14 +00:00
pi-ux-ce 4661627957 fix curl: (3) URL using bad/illegal format or missing URL
Gitea Actions Demo / Explore-Gitea-Actions (8.0.x) (push) Successful in 1m24s
2024-11-04 17:44:56 +00:00
pi-ux-ce 5a07f2f953 update kisscartoon URL and therefore test the CI
Gitea Actions Demo / Explore-Gitea-Actions (8.0.x) (push) Failing after 1m33s
2024-11-04 17:41:24 +00:00
pi-ux-ce f77b27e9ee trying to get a single package as for now we need the .dll with it
Gitea Actions Demo / Explore-Gitea-Actions (8.0.x) (push) Successful in 1m25s
2024-11-04 17:35:10 +00:00
pi-ux-ce 4ce9902947 use curl to upload the package
Gitea Actions Demo / Explore-Gitea-Actions (8.0.x) (push) Successful in 1m55s
2024-11-04 17:29:28 +00:00
pi-ux-ce 7b79c80b35 remove tab
Gitea Actions Demo / Explore-Gitea-Actions (8.0.x) (push) Failing after 1m45s
2024-11-04 17:27:06 +00:00
pi-ux-ce 9de0146cbb use curl to upload the package 2024-11-04 17:25:09 +00:00
pi-ux-ce 6da9c9c8da use curl to upload the package 2024-11-04 17:21:49 +00:00
42 changed files with 93 additions and 407 deletions
+14 -44
View File
@@ -4,8 +4,6 @@ on: [push]
jobs: jobs:
Explore-Gitea-Actions: Explore-Gitea-Actions:
env:
DOTNET_INSTALL_DIR: '.\.dotnet'
strategy: strategy:
matrix: matrix:
dotnet-version: [ '8.0.x' ] dotnet-version: [ '8.0.x' ]
@@ -13,27 +11,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Setup dotnet
- name: Cache dotnet
id: cache-dotnet
uses: actions/cache@v3
with:
path: ${{ env.DOTNET_INSTALL_DIR }}
key: ${{ runner.os }}-dotnet-${{ matrix.dotnet-version }}
restore-keys: ${{ runner.os }}-dotnet-${{ matrix.dotnet-version }}
- name: Install dotnet
if: ${{ steps.cache-dotnet.outputs.cache-hit != 'true' }}
uses: actions/setup-dotnet@v3 uses: actions/setup-dotnet@v3
with: with:
dotnet-version: ${{ matrix.dotnet-version }} dotnet-version: ${{ matrix.dotnet-version }}
# - name: Setup dotnet
# uses: actions/setup-dotnet@v3
# with:
# dotnet-version: ${{ matrix.dotnet-version }}
# cache: true
# cache-dependency-path: packages.lock.json
- name: Install dependencies - name: Install dependencies
run: dotnet restore run: dotnet restore
- name: Test with dotnet - name: Test with dotnet
@@ -41,30 +22,19 @@ jobs:
- name: Build the package - name: Build the package
run: dotnet build run: dotnet build
- name: Publish the package - name: Publish the package
run: dotnet publish run: dotnet publish -p:PublishSingleFile=true --self-contained false --runtime win-x64
- name: List files in the repository - name: List all files
run: | run: |
ls /workspace/pi-ux-ce/Simpsons_generator/bin/ find /workspace/pi-ux-ce/Simpsons_generator/bin
- name: List files in the repository
- name: Delete existing latest version
run: | run: |
ls /workspace/pi-ux-ce/Simpsons_generator/bin/Debug/ curl --user ${{ secrets.USERNAME_GITEA }}:${{ secrets.PASSWORD_GITEA }} -X DELETE \
- name: List files in the repository https://gitea.tryton.geeraert.eu/api/packages/pi-ux-ce/generic/Simpsons_generator/latest/Simpsons_generator.exe
- name: upload latest version
run: | run: |
ls /workspace/pi-ux-ce/Simpsons_generator/bin/Debug/net8.0/ curl --user ${{ secrets.USERNAME_GITEA }}:${{ secrets.PASSWORD_GITEA }} \
- name: Commit changes --upload-file /workspace/pi-ux-ce/Simpsons_generator/bin/Release/net8.0/win-x64/publish/Simpsons_generator.exe \
uses: EndBug/add-and-commit@v9 https://gitea.tryton.geeraert.eu/api/packages/pi-ux-ce/generic/Simpsons_generator/latest/Simpsons_generator.exe
with:
author_name: Pierre
author_email: pierre@geeraert.eu
message: 'automated push of build'
add: '/workspace/pi-ux-ce/Simpsons_generator/bin/Debug/net8.0/Simpsons_generator.exe'
- name: git push changes
uses: appleboy/git-push-action@v0.0.2
with:
author_email: pierre@geeraert.eu
author_name: Pierre
branch: main
commit: true
commit_message: "[skip ci] Updated changes by gitea bot"
remote: git@gitea.tryton.geeraert.eu:pi-ux-ce/Simpsons_generator.git
ssh_key: ${{ secrets.DEPLOY_KEY }}
+77 -72
View File
@@ -1,5 +1,7 @@
using System; using System;
using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.Data.SQLite;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using static System.Net.Mime.MediaTypeNames; using static System.Net.Mime.MediaTypeNames;
@@ -15,7 +17,26 @@ class Program
public static readonly string filePath = Path.Combine(folder_path, "episodes-watched.csv"); public static readonly string filePath = Path.Combine(folder_path, "episodes-watched.csv");
public static readonly string overrideBrowser = Path.Combine(folder_path, "overrideBrowser.xml"); public static readonly string overrideBrowser = Path.Combine(folder_path, "overrideBrowser.xml");
private static void openit(string url) static SQLiteConnection CreateConnection()
{
SQLiteConnection sqliteconn;
// Create a new database connection:
var sqllitedatasource = $"Data Source={folder_path}/database.db;Version=3;New=True;Compress=True;";
sqliteconn = new SQLiteConnection(sqllitedatasource);
// Open the connection:
try
{
sqliteconn.Open();
}
catch (Exception ex)
{
}
return sqliteconn;
}
private static void Openit(string url)
{ {
try try
{ {
@@ -84,92 +105,77 @@ class Program
} }
static object RunSQLQuery(SQLiteConnection conn, string query)
private static void saveIntoFile(string data_input)
{ {
SQLiteDataReader sqlite_datareader;
//first check if folder and file exist SQLiteCommand sqlite_cmd;
sqlite_cmd = conn.CreateCommand();
if (!Directory.Exists(folder_path)) sqlite_cmd.CommandText = query;
Directory.CreateDirectory(folder_path); sqlite_datareader = sqlite_cmd.ExecuteReader();
if (sqlite_datareader.Read())
using (StreamWriter w = new StreamWriter(filePath, true))
{ {
w.WriteLine(data_input); return sqlite_datareader["result"];
} }
else
{
return false;
}
} }
private static void SaveIntoDatabase(SQLiteConnection conn,int season, int episode)
{
SQLiteCommand sqliteCmd;
sqliteCmd = conn.CreateCommand();
string updateQuery = $"update episodes set seen=1 WHERE season = {season} and episode = {episode}";
sqliteCmd.CommandText = updateQuery;
sqliteCmd.ExecuteNonQuery();
}
static void Main(string[] args) static void Main(string[] args)
{ {
string url_generated; string urlGenerated;
int randomSeason;
int randomEpisode;
SQLiteConnection sqliteconn;
sqliteconn = CreateConnection();
bool restart = false; bool restart = false;
do do
{ {
restart = false; restart = false;
//get maximum number of seasons
string maximumNumberOfSeasonsQuery = "SELECT COUNT(DISTINCT season) as result FROM episodes;";
int maximumNumberSeasons = Convert.ToInt32(RunSQLQuery(sqliteconn, maximumNumberOfSeasonsQuery));
int maximum_number_seasons = 35;
string root_url = "https://www1.kisscartoon.online/episode/the-simpsons-season-";
//random for the season //random for the season
Random rnd = new Random(); Random rnd = new Random();
int random_season = rnd.Next(1, maximum_number_seasons); randomSeason = rnd.Next(1, maximumNumberSeasons);
Console.WriteLine("random season:"+random_season); Console.WriteLine("random season: "+randomSeason);
//dictionary for the maximum number of episodes
Dictionary<int, int> Season_nbr_Episodes = new Dictionary<int, int>();
Season_nbr_Episodes.Add(1,13);
Season_nbr_Episodes.Add(2,22);
Season_nbr_Episodes.Add(3,24);
Season_nbr_Episodes.Add(4,22);
Season_nbr_Episodes.Add(5,22);
Season_nbr_Episodes.Add(6,25);
Season_nbr_Episodes.Add(7,25);
Season_nbr_Episodes.Add(8,25);
Season_nbr_Episodes.Add(9,25);
Season_nbr_Episodes.Add(10,23);
Season_nbr_Episodes.Add(11,22);
Season_nbr_Episodes.Add(12,21);
Season_nbr_Episodes.Add(13,22);
Season_nbr_Episodes.Add(14,22);
Season_nbr_Episodes.Add(15,22);
Season_nbr_Episodes.Add(16,21);
Season_nbr_Episodes.Add(17,22);
Season_nbr_Episodes.Add(18,22);
Season_nbr_Episodes.Add(19,20);
Season_nbr_Episodes.Add(20,21);
Season_nbr_Episodes.Add(21,23);
Season_nbr_Episodes.Add(22,22);
Season_nbr_Episodes.Add(23,22);
Season_nbr_Episodes.Add(24,22);
Season_nbr_Episodes.Add(25,22);
Season_nbr_Episodes.Add(26,22);
Season_nbr_Episodes.Add(27,22);
Season_nbr_Episodes.Add(28,22);
Season_nbr_Episodes.Add(29,21);
Season_nbr_Episodes.Add(30,23);
Season_nbr_Episodes.Add(31,22);
Season_nbr_Episodes.Add(32,22);
Season_nbr_Episodes.Add(33,22);
Season_nbr_Episodes.Add(34,22);
Season_nbr_Episodes.Add(35,18);
int random_episode = rnd.Next(1,Season_nbr_Episodes[random_season]);
Console.WriteLine("random episode:"+random_episode);
//get maximum number of episodes for this season
string maximumNumberOfEpisodesQuery = $"SELECT COUNT() as result FROM episodes WHERE season = {randomSeason};";
int maximumNumberOfEpisodes = Convert.ToInt32(RunSQLQuery(sqliteconn, maximumNumberOfEpisodesQuery));
randomEpisode = rnd.Next(1, maximumNumberOfEpisodes);
Console.WriteLine("random episode: "+randomEpisode);
//url generated //url generated
url_generated = root_url + random_season + "-episode-"+random_episode; string urlGeneratedQuery = $"SELECT url as result FROM episodes WHERE season = {randomSeason} and episode = {randomEpisode};";
urlGenerated = Convert.ToString(RunSQLQuery(sqliteconn, urlGeneratedQuery));
//CheckEpisodeAlreadyRun
string checkEpisodeAlreadyRunQuery = $"SELECT seen as result FROM episodes WHERE season = {randomSeason} and episode = {randomEpisode};";
bool checkEpisodeAlreadyRun = Convert.ToBoolean(RunSQLQuery(sqliteconn, checkEpisodeAlreadyRunQuery));
Console.WriteLine(url_generated); if (checkEpisodeAlreadyRun)
if (CheckEpisodeAlreadyRun(url_generated))
{ {
//return; //return;
restart = true; restart = true;
@@ -180,11 +186,10 @@ class Program
} while (restart); } while (restart);
openit(url_generated); Console.WriteLine("urlGenerated "+urlGenerated);
Openit(urlGenerated);
saveIntoFile(url_generated); SaveIntoDatabase(sqliteconn,randomSeason,randomEpisode);
} }
} }
+2 -2
View File
@@ -1,6 +1,6 @@
import random import random
simpsons_url = "https://www1.kisscartoon.online/episode/the-simpsons-season-"; simpsons_url = "https://kisscartoon.top/episode/the-simpsons-season-";
number_of_seasons = 35 number_of_seasons = 35
seasons_maximum_number = [13,22,24,22,22,25,25,25,25,23,22,21,22,22,22,21,22,22,20,21,23,22,22,22,22,22,22,22,21,23,22,22,22,22,18] seasons_maximum_number = [13,22,24,22,22,25,25,25,25,23,22,21,22,22,22,21,22,22,20,21,23,22,22,22,22,22,22,22,21,23,22,22,22,22,18]
@@ -18,4 +18,4 @@ random_episode = random.randint(1, seasons_maximum_number[random_seasons-1])
print("random episode: "+ str(random_episode)) print("random episode: "+ str(random_episode))
final_url = simpsons_url+str(random_seasons)+ "-episode-"+str(random_episode) final_url = simpsons_url+str(random_seasons)+ "-episode-"+str(random_episode)
print(final_url) print(final_url)
Binary file not shown.
@@ -1,34 +0,0 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"Simpsons_generator/1.0.0": {
"dependencies": {
"Microsoft.NET.ILLink.Tasks": "8.0.8"
},
"runtime": {
"Simpsons_generator.dll": {}
}
},
"Microsoft.NET.ILLink.Tasks/8.0.8": {}
}
},
"libraries": {
"Simpsons_generator/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Microsoft.NET.ILLink.Tasks/8.0.8": {
"type": "package",
"serviceable": true,
"sha512": "sha512-P8wR6MUWwYXIjPJuBaZgo5zlI/GWI6QEAo6NyVIbPefa9CCkohYu7dP2rD/mrqnjEqfRHyl+h9VZrDoGpELqYg==",
"path": "microsoft.net.illink.tasks/8.0.8",
"hashPath": "microsoft.net.illink.tasks.8.0.8.nupkg.sha512"
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,12 +0,0 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
@@ -1,34 +0,0 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"Simpsons_generator/1.0.0": {
"dependencies": {
"Microsoft.NET.ILLink.Tasks": "8.0.8"
},
"runtime": {
"Simpsons_generator.dll": {}
}
},
"Microsoft.NET.ILLink.Tasks/8.0.8": {}
}
},
"libraries": {
"Simpsons_generator/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Microsoft.NET.ILLink.Tasks/8.0.8": {
"type": "package",
"serviceable": true,
"sha512": "sha512-P8wR6MUWwYXIjPJuBaZgo5zlI/GWI6QEAo6NyVIbPefa9CCkohYu7dP2rD/mrqnjEqfRHyl+h9VZrDoGpELqYg==",
"path": "microsoft.net.illink.tasks/8.0.8",
"hashPath": "microsoft.net.illink.tasks.8.0.8.nupkg.sha512"
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,13 +0,0 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
@@ -1,24 +0,0 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0/android-arm64",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {},
".NETCoreApp,Version=v8.0/android-arm64": {
"Simpsons_generator/1.0.0": {
"runtime": {
"Simpsons_generator.dll": {}
}
}
}
},
"libraries": {
"Simpsons_generator/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
@@ -1,13 +0,0 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
@@ -1,24 +0,0 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0/android-arm64",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {},
".NETCoreApp,Version=v8.0/android-arm64": {
"Simpsons_generator/1.0.0": {
"runtime": {
"Simpsons_generator.dll": {}
}
}
}
},
"libraries": {
"Simpsons_generator/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
@@ -1,13 +0,0 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
Binary file not shown.
@@ -1,24 +0,0 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0/linux-x64",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {},
".NETCoreApp,Version=v8.0/linux-x64": {
"Simpsons_generator/1.0.0": {
"runtime": {
"Simpsons_generator.dll": {}
}
}
}
},
"libraries": {
"Simpsons_generator/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
Binary file not shown.
Binary file not shown.
@@ -1,13 +0,0 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
@@ -1,24 +0,0 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0/linux-x64",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {},
".NETCoreApp,Version=v8.0/linux-x64": {
"Simpsons_generator/1.0.0": {
"runtime": {
"Simpsons_generator.dll": {}
}
}
}
},
"libraries": {
"Simpsons_generator/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
@@ -1,13 +0,0 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
@@ -1,35 +0,0 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0/win-x64",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {},
".NETCoreApp,Version=v8.0/win-x64": {
"Simpsons_generator/1.0.0": {
"dependencies": {
"Microsoft.NET.ILLink.Tasks": "8.0.8"
},
"runtime": {
"Simpsons_generator.dll": {}
}
},
"Microsoft.NET.ILLink.Tasks/8.0.8": {}
}
},
"libraries": {
"Simpsons_generator/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Microsoft.NET.ILLink.Tasks/8.0.8": {
"type": "package",
"serviceable": true,
"sha512": "sha512-P8wR6MUWwYXIjPJuBaZgo5zlI/GWI6QEAo6NyVIbPefa9CCkohYu7dP2rD/mrqnjEqfRHyl+h9VZrDoGpELqYg==",
"path": "microsoft.net.illink.tasks/8.0.8",
"hashPath": "microsoft.net.illink.tasks.8.0.8.nupkg.sha512"
}
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,13 +0,0 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
BIN
View File
Binary file not shown.