### Setup Linux Virtual Environment
Source: https://github.com/mylarcomics/mylar3/blob/stable/tests/README.md
Create a Python 3.8 virtual environment on Linux. Ensure Python 3.8 is installed and accessible.
```bash
python3.8 -m venv /path/to/your/env
```
--------------------------------
### Setup Windows Virtual Environment
Source: https://github.com/mylarcomics/mylar3/blob/stable/tests/README.md
Create a Python 3.8 virtual environment on Windows using the Python launcher. Ensure Python 3.8 is installed and accessible.
```bat
py -3.8 -m venv C:\YourNewEnv
```
--------------------------------
### Page Initialization and Fancybox Setup
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/weeklypull.html
Sets up the page by calling initThisPage and initializes fancybox after a delay.
```javascript
resetFilters("weekly");
setTimeout(function(){
initFancybox();
},1500)
}
$(document).ready(function() {
initThisPage();
});
```
--------------------------------
### Test qBittorrent Connection
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/config.html
Sends a GET request to the 'testqbit' endpoint to verify qBittorrent connection details. Updates status icon and displays a message based on the response.
```javascript
$('#qbittorrent_test').click(function () { var imagechk = document.getElementById("qbittorrent_statusicon"); var host = document.getElementById("qbittorrent_host").value; var username = document.getElementById("qbittorrent_username").value; var password = document.getElementById("qbittorrent_password").value; $.get("testqbit", { host: host, username: username, password: password }, function(data){ if (data.error != undefined) { alert(data.error); return; } $('#ajaxMsg').removeClass(); $('#ajaxMsg').html("
"+data+"
"); if ( data.indexOf("Successfully") > -1){ imagechk.src = ""; imagechk.src = "images/success.png"; imagechk.style.visibility = "visible"; } else { imagechk.src = ""; imagechk.src = "images/x_red.png"; imagechk.style.visibility = "visible"; } }); $('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut(); });
```
--------------------------------
### Page Initialization and Data Table Setup
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/storyarc_detail.poster.html
Initializes the page by setting up jQuery UI tabs, custom actions, and a DataTables instance for the 'arc_detail' table with specific language settings and pagination.
```javascript
function initThisPage() {
$(function() {
$( "#tabs" ).tabs();
});
initActions();
$('#arc_detail').dataTable( {
"bDestroy": true,
"oLanguage": {
"sLengthMenu":"Show _MENU_ items per page",
"sEmptyTable": "No History to Display",
"sInfo":"Showing _START_ to _END_ of _TOTAL_ items",
"sInfoEmpty":"Showing 0 to 0 of 0 items",
"sInfoFiltered":"(filtered from _MAX_ total items)"
},
"iDisplayLength": 25,
"sPaginationType": "full_numbers",
"aaSorting": []
})
resetFilters("item");
}
$(document).ready(function() {
initThisPage();
initActions();
});
```
--------------------------------
### Initiate File Download
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/comicdetails_update.html
Makes an AJAX GET request to the 'downloadthis' endpoint with a specified file path. This function likely triggers a server-side download process.
```javascript
function shizzlemedown(filepath){
$.ajax({
type: "GET",
url: "downloadthis",
data: { pathfile: filepath },
})
}
```
--------------------------------
### Downloading a Specific Release
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/comicdetails_update.html
Handles the download of a specific release based on its index in the search results. It makes an AJAX GET request to 'download_specific_release' and displays a success or error message.
```javascript
function downloadSpecificRelease(i){
name = search_results[i].nzbtitle;
prov = search_results[i].tmpprov;
nzbid = search_results[i].nzbid;
ShowSpinner();
$.get("download_specific_release", { nzbid: nzbid, provider: prov, name: name }, function(data) {
if (data.error != undefined) {
alert(data.error);
return;
}
$('#ajaxMsg').html("Successfully downloaded "+name+"
");
if ( data.indexOf("success") > -1){
$("#choose_specific_download_dialog").dialog.close();
}
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
return false;
});
}
```
--------------------------------
### Fetching Available Downloads for an Issue
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/comicdetails_update.html
Initiates a search for available downloads for a given issue ID. It displays a 'searching' message, makes an AJAX GET request to 'choose_specific_download', and populates a data table with the results. A modal dialog is then shown with the download options.
```javascript
function getAvailableDownloads(issueid) {
ShowSpinner();
$('#ajaxMsg').html("Now searching...
");
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
$.getJSON("choose_specific_download", {issueid: issueid}, function(data) {
loader.remove();
feedback.fadeOut();
search_results = data;
for( var i = 0, len = data.length; i < len; i++ ) {
$('#downloads_table_body').append('| '+data[i].nzbtitle+' | '+data[i].provider+' | '+data[i].size+' | '+data[i].kind+' |
');
}
$('#downloads_table').dataTable({
"aoColumns": [ null, null, null, null ],
"aaSorting": [ [ 1, 'desc' ] ],
"bFilter": false,
"bInfo": false,
"bPaginate": false,
"bDestroy": true
});
$("#choose_specific_download_dialog").dialog({
modal: true,
width: "60%",
maxHeight: 500
});
return false;
});
}
```
--------------------------------
### Group Metatag Series via AJAX
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/comicdetails_update.html
Initiates a metatagging process for an entire series via an AJAX GET request. Provides immediate UI feedback indicating the process has started.
```javascript
function group_metatag(comicid){ $('#ajaxMsg').html("Now metatagging complete series...
"); $('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut(); //$('#ajaxMsg').removeClass(); $.w
```
--------------------------------
### Initialize Page UI Elements and Event Handlers
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/config.html
Sets up the initial state and event listeners for various UI elements on the configuration page. This includes toggling visibility for API, OPDS, and airdcpp options based on checkbox states.
```javascript
function initThisPage() {
var prov_start_id = 0;
if ($("#api_enabled").is(":checked")) {
$("#apioptions").show();
} else {
$("#apioptions").hide();
}
$("#api_enabled").click(function(){
if ($("#api_enabled").is(":checked")) {
$("#apioptions").slideDown();
} else {
$("#apioptions").slideUp();
}
});
if ($("#opds_enable").is(":checked")) {
$("#opdsoptions").show();
updateopds_url();
} else {
$("#opdsoptions").hide();
document.getElementById("opds_url").style.display = 'none';
}
$("#opds_enable").click(function(){
if ($("#opds_enable").is(":checked")) {
$("#opdsoptions").slideDown();
updateopds_url();
} else {
$("#opdsoptions").slideUp();
document.getElementById("opds_url").style.display = 'none';
}
});
if ($("#opds_authentication").is(":checked")) {
$("#opdscredentials").show();
} else {
$("#opdscredentials").hide();
}
$("#opds_authentication").click(function(){
if ($("#opds_authentication").is(":checked")) {
$("#opdscredentials").slideDown();
} else {
$("#opdscredentials").slideUp();
}
});
if ($("#enable_airdcpp").is(":checked")) {
$("#airdcpp_options").show();
} else {
$("#airdcpp_options").hide();
}
$("#enable_airdcpp").click(function(){
if ($("#enable_airdcpp").is(":checked")) {
$("#airdcpp_options").slideDown();
} else {
$("#airdcpp_options").slideUp();
}
});
if ($("#enable_ddl").is(":checked")) {
if ( document.getElementById("enable_getcomics").checked == false ){
// document.getElementById("enable_getcomics").checked = true;
// document.getElementById("enable_getcomics").setAttribute("disabled", "disabled");
$("#gc_options").slideUp();
} else {
$("#gc_options").slideDown();
}
$("#ddl_providers").slideDown();
} else {
//document.getElementById("enable_getcomics").checked = false;
$("#ddl_providers").slideUp();
$("#gc_options").slideUp();
}
$("#enable_ddl").click(function(){
if ($("#enable_ddl").is(":checked")) {
if ( document.getElementById("enable_getcomics").checked == false ){
// document.getElementById("enable_getcomics").checked =
```
--------------------------------
### Retrieving Comic ID
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/comicdetails_update.html
Gets the value of the 'ComicID' input element from the DOM.
```javascript
function retrieve_comicid() {
return document.getElementById("ComicID").value;
}
```
--------------------------------
### Page Initialization and Ready Handler
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/manage.html
Calls initialization functions and sets up a document ready handler for the page.
```javascript
initActions();
startTime();
};
$(document).ready(function() {
initThisPage();
});
```
--------------------------------
### Clear Notifications
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/base.html
Sends an AJAX GET request to 'clear_notifs' to clear user notifications. Updates the UI with the response message and status.
```javascript
function clear_notifs(){
$.when($.ajax({
type: "GET",
url: "clear_notifs",
data: { session_id: "${mylar.SESSION_ID}" },
success: function(response) {
obj = JSON.parse(response);
$('#ajaxMsg').html(""+obj['message']+"
");
if (obj['status'] == 'success'){
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
} else {
$('#ajaxMsg').addClass('error').fadeIn().delay(3000).fadeOut();
}
},
error: function(data) {
alert('ERROR'+data.responseText);
},
})).done(function(data) {
notif_checks();
});
}
```
--------------------------------
### Check GitHub for Updates
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/base.html
Performs an AJAX GET request to the 'checkGithub' endpoint to check for new versions. Updates the UI to indicate the check status.
```javascript
function check_the_hub(){
update_line();
$.when($.ajax({
type: "GET",
url: "checkGithub",
success: function(response) {
//obj = JSON.parse(response);
//$('#ajaxMsg').html(""+obj['message']+"
");
//if (obj['status'] == 'success'){
// $('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
//} else {
// $('#ajaxMsg').addClass('error').fadeIn().delay(3000).fadeOut();
//}
},
error: function(data) {
alert('ERROR'+data.responseText);
},
})).done(function(data) {
$("#version_line").html('Check for new version');
});
}
```
--------------------------------
### Initialize Page Actions
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/weeklypull.html
Sets up event listeners for various UI elements on the page, including the week folder checkbox, delete menu link, and publisher button. It also initializes the selectize dropdown for publishers.
```javascript
function initThisPage() {
$("#weekfolder").click(function(){
if ($("#weekfolder").is(":checked")) {
$("#MassDownload").submit();
return true;
} else {
$("#MassDownload").submit();
return true;
}
});
$("#menu_link_delete").click(openMassAdd);
$("#pub_button").click(run_them);
// The linkfeedback class click handler
$('body').on('click', 'a[href="#"]', function() {
var savet = this;
$(this).css('position', 'relative').css('top', '3px');
setTimeout(function() {
$(savet).css('font-weight', '')
}, 200);
setTimeout(function() {
$(savet).css('position', '').css('top', '')
}, 400);
});
initActions();
$(function selector() {
weeknumber = document.getElementById("massnumber").value;
weekyear = document.getElementById("massyear").value;
$.when($.ajax({
type: "GET",
url: "get_the_pubs",
dataType: 'json',
success: function ( response ) {
results = response;
},
error: function (data) {
var options = []
},
})).done(function(data) {
var options = []
$.each(results, function() {
options.push({ name : this.name });
})
//options = [{"name":"publisher name here"}];
try {
items = options.map(x => x.name);
} catch(e) {
const options = []
items = [];
}
$( "#publishers" ).selectize({
valueField: 'name',
labelField: 'name',
sear
```
--------------------------------
### Initialize Page and DataTables
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/comicdetails_update.html
Sets up the page by calling initialization functions and setting up event listeners for DataTables instances, including handling collapsed groups and tab loading.
```javascript
initThisPage();
var tables = $('table.display').DataTable();
$('#annual_table').on('click', 'tr.dtrg-start', function() {
var name = $(this).data('name');
collapsedGroups[name] = !collapsedGroups[name];
$('#annual_table').DataTable().draw(false);
});
display_date(null);
title_loading();
```
--------------------------------
### Mark Search Results
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/searchresults.html
Performs an action (e.g., mark, unmark) on selected search results via an AJAX GET request to the 'markseries' endpoint.
```javascript
function mark_the_results(){ var action=$("#mark_results option:selected").val(); var checks = document.getElementsByName("comicid[]"); var query_id = retrieve_searchquery(); var checkboxesChecked = []; for (var i=0; i' + escape(item.name) + '';
}
},
load: function(query, callback) {
$.ajax({
type: "GET",
url: "weekly_publisherlisting",
contentType: "application/json; charset=utf-8",
data: {
weeknumber: weeknumber,
year: weekyear
},
dataType: 'json',
error: function() {
callback();
},
success: function (res) {
var rspns = eval(res)
callback(rspns);
}
});
},
});
```
--------------------------------
### Collecting Series Listing Data
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/comicdetails_update.html
Fetches the series listing data using an AJAX GET request. The response is evaluated as JavaScript and passed to a callback function.
```javascript
function collectgroup() {
$.ajax({
type: "GET",
url: "serieslisting",
success: function (response) {
var rspns = eval(response);
callback(rspns);
}
});
}
```
--------------------------------
### Run All Tests
Source: https://github.com/mylarcomics/mylar3/blob/stable/tests/README.md
Execute all tests in the 'tests' directory from the project root. This command runs the full test suite.
```bash
pytest tests
```
--------------------------------
### Document Ready Initialization
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/config.html
Executes initialization functions when the document is fully loaded. This includes setting up the page, annuals integration, and checking requirements.
```javascript
$(document).ready(function() {
initThisPage();
annuals_integration()
check_requirements();
});
```
--------------------------------
### Validate Banner URL Input
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/storyarc_detail.html
Validates the banner image URL input. It prevents form submission if the URL is empty or does not start with 'http', providing visual feedback to the user.
```javascript
function checkValids(e) {
var urlchk = document.getElementById("banner_url");
if (urlchk.value == ""){
e.preventDefault(); //alert("1 - no url");
urlchk.placeholder = "Invalid URL";
timeout = setTimeout(function() {
urlchk.placeholder = "full URL where image resides";
}, 5000);
return false;
} else {
if (urlchk.value.startsWith("http")){
//alert("url provided");
return true;
}
}
//alert("2 - no url");
e.preventDefault();
urlchk.placeholder = "Invalid URL";
timeout = setTimeout(function() {
urlchk.placeholder = "full URL where image resides";
}, 5000);
return false;
}
```
--------------------------------
### Open Log Window
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/importresults.html
Handles the click event for '.showlog' links to open a new browser window for logs. Configures window size, position, and options.
```javascript
$('.showlog').click(function (event) {
var width = 575,
height = 400,
left = ($(window).width() - width) / 2,
top = ($(window).height() - height) / 2,
url = this.href,
opts = 'status=1' + ',width=' + width + ',height=' + height + ',top=' + top + ',left=' + left;
window.open(url, 'twitte', opts);
return false;
});
```
--------------------------------
### Toggle JDownloader 2 Options Visibility
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/config.html
Controls the display of JDownloader 2 specific options based on the 'jd2_enable' checkbox state.
```javascript
if ($("#jd2_enable").is(":checked")) {
$("#jd2_options").slideDown();
} else {
$("#jd2_options").slideUp();
}
$("#jd2_enable").click(function(){
if ($("#jd2_enable").is(":checked")) {
$("#jd2_options").slideDown();
} else {
$("#jd2_options").slideUp();
}
});
```
--------------------------------
### Metatag Selected Issues
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/comicdetails_update.html
Performs a bulk metatag operation for selected issues within a comic. It gathers checked issue IDs and sends them via an AJAX GET request to 'bulk_metatag'.
```javascript
function metatag_the_issues(comicid, tabletype){ $("#ajaxMsg").html("Now metatagging selected items...
"); $("#ajaxMsg").addClass('success').fadeIn().delay(3000).fadeOut(); if (tabletype == 'issues'){ var checks = document.getElementsByName("issueid[]"); } else { var checks = document.getElementsByName("aissueid[]"); } var checkboxesChecked = []; for (var i=0; i"+obj['message']+"");
if (obj['status'] == 'success'){
$('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut();
} else {
$('#ajaxMsg').addClass('error').fadeIn().delay(3000).fadeOut();
}
},
error: function(data) {
alert('ERROR'+data.responseText);
},
});
var tables = $('table.display').DataTable();
tables.ajax.reload(null,false);
}
```
--------------------------------
### Initiate Specific Release Download
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/weeklypull.html
Downloads a specific release after it has been selected from the available downloads list. This function is called from the `getAvailableDownloads` function.
```javascript
function downloadSpecificRelease(i){
name = search_results[i].nzbtitle
prov = search_results[i].tmpprov
nzbid = search_results[i].nzbid
ShowSpinner();
$.getJSON("download_specific_release", {nzbid: nzbid, provider: prov, name: name}, function(data) {
loader.remove();
feedback.fadeOut();
refreshSubmenu();
$("#choose_specific_download_dialog").dialog("close");
});
}
```
--------------------------------
### Initialize Data Table for Failed Downloads
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/managefailed.html
Initializes a DataTable with specific configurations for managing failed downloads. Includes custom sorting, filtering, and selection behavior for checkboxes.
```javascript
var lastChecked = null;
function initThisPage() {
$('#manage_failed').dataTable( {
"bDestroy": true,
"aoColumnDefs": [
{ 'bSortable': false, 'aTargets': [ 0 , 2 ] },
{ 'bVisible': false, 'aTargets': [2] },
{ 'sType': 'numeric', 'aTargets': [2] },
{ 'columns.orderData': [2], 'aTargets': [3] }
],
"aLengthMenu": [ [10, 25, 50, -1], [10, 25, 50, 'All' ] ],
"oLanguage": {
"sLengthMenu":"Show _MENU_ results per page",
"sEmptyTable": "No results",
"sInfo":"Showing _START_ to _END_ of _TOTAL_ results",
"sInfoEmpty":"Showing 0 to 0 of 0 results",
"sInfoFiltered":"(filtered from _MAX_ total results)",
"sSearch" : ""
},
"bStateSave": true,
"iDisplayLength": 25,
"sPaginationType": "full_numbers",
"aaSorting": [[1, 'desc'],[2, 'desc']]
});
resetFilters("failed");
$('#manage_failed tbody').on('click', 'input[type="checkbox"]', function(e){
var chkboxes = Array.from($(":checkbox"));
if (!lastChecked) {
lastChecked = this;
} else {
if (e.shiftKey) {
var start = chkboxes.indexOf(lastChecked);
var end = chkboxes.indexOf(this);
var positive = start < end;
for (var i = (positive ? start: end ); (positive ? i <= end : i <= start); i++) {
chkboxes[i].checked = lastChecked.checked;
}
lastChecked = null;
} else {
lastChecked = this;
}
}
});
}
$(document).ready(function(){
initThisPage();
});
$(window).load(function(){
initFancybox();
});
```
--------------------------------
### Update Series Filter Counts via AJAX
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/comicdetails_update.html
Fetches updated filter counts for a series using an AJAX GET request. Updates the displayed counts for 'wanted', 'downloaded', and 'skipped' statuses.
```javascript
function update_filters() {
var comicid = retrieve_comicid();
$.when($.ajax({
type: "GET",
url: "update_series_filters",
data: { comicid: comicid },
success: function(response) {
obj = JSON.parse(response);
if (obj['status'] == 'success'){
obj_filters = obj['filters']
wantedcount = document.getElementById("wantedlabel");
if (parseInt(obj_filters['wanted'], 10) > 0){
wantedcount.style.display = "inline";
document.getElementById("wantedcount").innerHTML = obj_filters['wanted'];
} else if (parseInt(obj_filters['wanted'], 10) <= 0) {
document.getElementById("wantedcount").innerHTML = "";
wantedcount.style.display = "none";
}
downloadedcount = document.getElementById("downloadedlabel");
if (parseInt(obj_filters['downloaded'], 10) > 0){
downloadedcount.style.display = "inline";
document.getElementById("downloadedcount").innerHTML = obj_filters['downloaded'];
} else if (parseInt(obj_filters['downloaded'], 10) <= 0) {
document.getElementById("downloadedcount").innerHTML = "";
downloadedcount.style.display = "none";
}
skippedcount = document.getElementById("skippedlabel");
if (parseInt(obj_filters['skipped'], 10) > 0){
s
```
--------------------------------
### JavaScript: Initialize Page and Event Listeners
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/cblimport.html
This function initializes the page by setting up the tabbed interface, binding event listeners to buttons and file inputs, and configuring the DataTable for displaying import results. It ensures all necessary components are ready before user interaction.
```javascript
function initThisPage() {
jQuery( "#tabs" ).tabs();
initActions();
$('#cblfileinput').change(cblUpload);
$('#cblfileselectbutton').click(triggerFileSelect);
$('#cblfilenamelabel').click(triggerFileSelect);
$('#processlistbutton').click(processCBL);
$('#cblimporttable').dataTable( {
destroy: true,
sDom: '<"clear"Af><"clear"lp><"clear">rt<"clear"ip>',
LengthMenu: [[10, 25, 50, -1], [10, 25, 50, 'All']],
Language: {
LengthMenu:"Show _MENU_ results per page",
EmptyTable: "No results",
Info:"Showing _START_ to _END_ of _TOTAL_ results",
InfoEmpty:"Showing 0 to 0 of 0 results",
InfoFiltered:"(filtered from _MAX_ total results)",
Search : ""
},
columns: [
{className: "list_index"},
{className: "volume"},
{className: "issue"},
{className: "status"},
{className: "action"}
],
StateSave: true,
stateDuration: 0,
pageLength: 50,
pagingType: "simple_numbers",
aaSorting: [[0, 'asc']]
});
resetFilters("result");
}
$(document).ready(function(){
initThisPage();
});
$(window).load(function(){
initFancybox();
});
```
--------------------------------
### Iterate and Read RAR Archive Entries
Source: https://github.com/mylarcomics/mylar3/blob/stable/lib/rarfile/doc/api.md
Demonstrates how to open a RAR archive, iterate through its contents using infolist(), and read the content of a specific file.
```python
import rarfile
rf = rarfile.RarFile("myarchive.rar")
for f in rf.infolist():
print(f.filename, f.file_size)
if f.filename == "README":
print(rf.read(f))
```
--------------------------------
### Run Single Metatag Operation
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/comicdetails_update.html
Initiates a manual metatag operation for a specific issue within a comic. It sends the issue ID and comic ID via an AJAX GET request to 'manual_metatag'.
```javascript
function run_single_metatag(issueid, comicid, issuenumber){ $("#ajaxMsg").html("Now metatagging #"+issuenumber+"...
"); $("#ajaxMsg").addClass('success').fadeIn().delay(3000).fadeOut(); $.when($.ajax({ type: "GET", url: "manual_metatag", data: { issueid: issueid, comicid: comicid }, success: function(response) { //obj = JSON.parse(response); //$('#ajaxMsg').html(""+obj['message']+"
"); //if (obj['status'] == 'success'){ // $('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut(); //} else { // $('#ajaxMsg').addClass('error').fadeIn().delay(3000).fadeOut(); //} }, error: function(data) { alert('ERROR'+data.responseText); }, })).done(function(data) { //reload_tables(); }); }
```
--------------------------------
### Configure Torrent Downloader Options
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/config.html
Manages the visibility of different torrent downloader settings (Watchlist, uTorrent, rTorrent, Transmission, Deluge, qBittorrent) based on radio button selection.
```javascript
if ($("#torrent_downloader_watchlist").is(":checked")) { $("#utorrent_options,#rtorrent_options,#transmission_options,#deluge_options,#qbittorrent_options").hide(); $("#watchlist_options").show(); }
if ($("#torrent_downloader_utorrent").is(":checked")) { $("#watchlist_options,#rtorrent_options,#transmission_options,#deluge_options,#qbittorrent_options").hide(); $("#utorrent_options").show(); }
if ($("#torrent_downloader_rtorrent").is(":checked")) { $("#utorrent_options,#watchlist_options,#transmission_options,#deluge_options,#qbittorrent_options").hide(); $("#rtorrent_options").show(); }
if ($("#torrent_downloader_transmission").is(":checked")) { $("#utorrent_options,#rtorrent_options,#watchlist_options,#deluge_options,#qbittorrent_options").hide(); $("#transmission_options").show(); }
if ($("#torrent_downloader_deluge").is(":checked")) { $("#utorrent_options,#rtorrent_options,#watchlist_options,#transmission_options,#qbittorrent_options").hide(); $("#deluge_options").show(); }
if ($("#torrent_downloader_qbittorrent").is(":checked")) { $("#utorrent_options,#rtorrent_options,#watchlist_options,#transmission_options,#deluge_options").hide(); $("#qbittorrent_options").show(); }
```
--------------------------------
### Fetch Group Metatag Data
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/comicdetails_update.html
Initiates an AJAX GET request to 'group_metatag' to retrieve metadata for a specific comic ID. Handles success by parsing the JSON response and logs errors to the console.
```javascript
function group_metatag(comicid){ $("#ajaxMsg").html("Now fetching metadata for comic "+comicid+"...
"); $("#ajaxMsg").addClass('success').fadeIn().delay(3000).fadeOut(); $.when($.ajax({ type: "GET", url: "group_metatag", data: { ComicID: comicid }, success: function(response) { obj = JSON.parse(response); }, error: function(data) { alert('ERROR'+data.responseText); }, })).done(function(data) { //reload_tabs(); //reload_tables(); }); }
```
--------------------------------
### Document Ready Initialization
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/storyarc.html
Ensures that the page initialization functions are called once the DOM is fully loaded.
```javascript
$(document).ready(function() {
initThisPage();
initActions();
});
```
--------------------------------
### Manual Rename Series via AJAX
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/comicdetails_update.html
Initiates a manual renaming process for files associated with a series ID via an AJAX GET request. Provides UI feedback on the renaming status.
```javascript
function manual_rename(comicid){ $('#ajaxMsg').html("Mass Renaming files for series...
"); $('#ajaxMsg').addClass('success').fadeIn().delay(3000).fadeOut(); $('#ajaxMsg').removeClass(); $.when($.ajax({ type: "GET", url: "manualRename", data: { comicid: comicid }, success: function(response) { obj = JSON.JSON.parse(response); $("#ajaxMsg").html("Successfully renamed series.
"); if (obj['status'] == 'success'){ $("#ajaxMsg").addClass('success').fadeIn().delay(3000).fadeOut(); } else { $("#ajaxMsg").addClass('error').fadeIn().delay(3000).fadeOut(); } }, error: function(data) { alert('ERROR'+data.responseText); }, })).done(function(data) { //var url = $(location).attr('href'); //var tabId = $('.ui-tabs-panel:visible').attr("id"); //$('.ui-tabs-panel:visible').load(url + " #"+ tabId, function() { // $("#tabs").tabs() //}); //reload_tabs(); //reload_tables(); }); }
```
--------------------------------
### Opening Delete Confirmation Dialog
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/comicdetails_update.html
Initializes a modal dialog for delete confirmation.
```javascript
function openDelete() {
$("#dialog").dialog({modal:true});
}
```
--------------------------------
### Retry Issue Processing via AJAX
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/comicdetails_update.html
Initiates a retry for a specific comic issue using an AJAX GET request. Updates the UI with the processing status and reloads tables upon completion.
```javascript
function retry_issue(issueid, comicid, rlscomicid){ $.when($.ajax({ type: "GET", url: "retryit", data: { IssueID: issueid, ComicID: comicid, ReleaseComicID: rlscomicid }, success: function(response) { obj = JSON.parse(response); $("#ajaxMsg").html(""+obj['message']+"
"); if (obj['status'] == 'success'){ $("#ajaxMsg").addClass('success').fadeIn().delay(3000).fadeOut(); } else { $("#ajaxMsg").addClass('error').fadeIn().delay(3000).fadeOut(); } }, error: function(data) { alert('ERROR'+data.responseText); }, })).done(function(data) { reload_tables(); }); }
```
--------------------------------
### Show/Hide Downloader Options
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/config.html
Dynamically shows or hides configuration options based on the selected torrent downloader. Uses jQuery for DOM manipulation.
```javascript
function () {
if ($("#torrent_downloader_utorrent").is(":checked")) {
$("#utorrent_options,#watchlist_options,#transmission_options,#deluge_options,#qbittorrent_options").fadeOut("fast", function() {
$("#utorrent_options").fadeIn()
});
}
if ($("#torrent_downloader_rtorrent").is(":checked")) {
$("#utorrent_options,#watchlist_options,#transmission_options,#deluge_options,#qbittorrent_options").fadeOut("fast", function() {
$("#rtorrent_options").fadeIn()
});
}
if ($("#torrent_downloader_transmission").is(":checked")) {
$("#utorrent_options,#rtorrent_options,#watchlist_options,#deluge_options,#qbittorrent_options").fadeOut("fast", function() {
$("#transmission_options").fadeIn()
});
}
if ($("#torrent_downloader_deluge").is(":checked")) {
$("#utorrent_options,#rtorrent_options,#watchlist_options,#transmission_options,#qbittorrent_options").fadeOut("fast", function() {
$("#deluge_options").fadeIn()
});
}
if ($("#torrent_downloader_qbittorrent").is(":checked")) {
$("#utorrent_options,#rtorrent_options,#watchlist_options,#transmission_options,#deluge_options").fadeOut("fast", function() {
$("#qbittorrent_options").fadeIn()
});
}
});
```
--------------------------------
### Moving Skipped Comics to Wanted
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/comicdetails_update.html
Converts skipped comics to wanted comics for a given comic ID. It makes an AJAX GET request to 'skipped2wanted' and displays a success or error message based on the response.
```javascript
function skipped2wanted() {
var comicid = retrieve_comicid();
$.when($.ajax({
type: "GET",
url: "skipped2wanted",
data: { comicid: comicid },
success: function(response) {
obj = JSON.parse(response);
$('#ajaxMsg').html(""+obj['message']+"
");
if (obj['status'] == 'success'){
$('#a
```
--------------------------------
### Fetch Issue Information and Metadata
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/comicdetails_update.html
Retrieves detailed information and metadata for a specific issue using an AJAX GET request to 'IssueInfo'. It then constructs HTML to display the comic image, series details, and metadata.
```javascript
function runMetaIssue(issueid) { $.ajax({ type: "GET", url: "IssueInfo", data: { issueid: issueid }, success: function(response) { obj = JSON.parse(response); if (obj['status'] == 'success'){ obj_meta = obj['metadata']; line = ''; line += ' '; line += ''; if (obj_meta['issue_number']){ line += ''+obj_meta['series']+'#'+obj_meta['issue_number']+''; } else { line += ''+obj_meta['series']+''; } if (obj_meta['issue_title']){ line += ''+obj_meta['issue_title']+''; } if (obj_meta['issuedate']){ line +=''+obj_meta['issuedate']+' '; } if (obj_meta['writers']){ line +='Writers:'+obj_meta['writers']; } if (obj_meta['inkers']){ line +='Inkers:'+obj_meta['inkers']; } if (obj_meta['pencillers']){ line +='Pencillers:'+obj_meta['pencillers']; } if (obj_meta['colorists']){ line +='Colorists:'+obj_meta['colorists']; } if (obj_meta['letterers']){ line +='Letterers:'+obj_meta['letterers']; } if (obj_meta['editors']){ line +='Editors:'+obj_meta['editors']; } if (obj_meta['cover_artists']){ line +='Cover Artists:'+obj_meta['cover_artists']; } if (obj_meta['pagecount']){ line += '...'+obj_meta['pagecount']+' pages '; } line += ''; line += ' |
'; desc_line = ''; if (obj_meta['summary']){ desc_line += '| Summary: '+obj_meta['summary']+' |
'; } else { desc_line += '| No summary available |
'; } if (obj_meta['filename']){ iss_filename = obj_meta['filename']; } else { iss_filename = 'No local filename present'; } desc_line += '| '+iss_filename+' |
'; if (obj_meta['metadata_type'] || obj_meta['metadata_source']){ desc_line += '' if (obj_meta['metadata_type']){ desc_line += '| '+obj_meta['metadata_type']+' | '; } if (obj_meta['metadata_source']){ desc_line += ''+obj_meta['metadata_source']+' | '; } desc_line += '
'; } desc_line += '
'; $("#issueInfo").html(line+desc_line); } else { $("#ajaxMsg").html(""+obj\["message"\]+"
"); $("#ajaxMsg").addClass('error').fadeIn().delay(3000).fadeOut(); } }, error: function(data) { alert('ERROR'+data.responseText); }, }); }
```
--------------------------------
### Read RAR Archive Entries Using Context Manager
Source: https://github.com/mylarcomics/mylar3/blob/stable/lib/rarfile/doc/api.md
Shows how to open a RAR archive using a context manager and read file contents line by line.
```python
import rarfile
with rarfile.RarFile("archive.rar") as rf:
with rf.open("README") as f:
for ln in f:
print(ln.strip())
```
--------------------------------
### Initialize Page Elements and Data Table
Source: https://github.com/mylarcomics/mylar3/blob/stable/data/interfaces/default/storyarc_detail.html
Initializes the page by setting up jQuery UI tabs, custom actions, and a DataTables instance for the 'arc_detail' table with specific language settings and pagination.
```javascript
function initThisPage() {
$(function() {
$( "#tabs" ).tabs();
});
initActions();
$('#arc_detail').dataTable( {
"bDestroy": true,
"oLanguage": {
"sLengthMenu":"Show _MENU_ items per page",
"sEmptyTable": "No History to Display",
"sInfo":"Showing _START_ to _END_ of _TOTAL_ items",
"sInfoEmpty":"Showing 0 to 0 of 0 items",
"sInfoFiltered":"(filtered from _MAX_ total items)"
},
"iDisplayLength": 25,
"sPaginationType": "full_numbers",
"stateDuration": 0,
"stateSave": true,
"aaSorting": []
})
resetFilters("item");
}
$(document).ready(function() {
initThisPage();
initActions();
});
```