Compare commits

..

No commits in common. "4dee7757a59f2489dd4c488c0a34a95e1fb09159" and "106b75ca62b95d2dde2cabaf71b9021ffedb52b1" have entirely different histories.

3 changed files with 1 additions and 134 deletions

View file

@ -1,5 +1,2 @@
# QuteBrowser QuickMarks Browser #
QBQMB est un navigateur de favoris (quickmarks) pour le navigateur QuteBrowser. Il est écrit en bash, et sa seule dépendance est dialog
# QuteBrowser To Firefox #
qbtoff-fr.py est un script permettant de convertir les marques pages de QuteBrowser (quickmarks) vers un fichier HTML importable sur Firefox et ses dérivés (testé avec Waterfox OK). Cela doit aussi fonctionner avec Chrome (pas testé).
QBQMB est un navigateur de favoris (quickmarks) pour le navigateur QuteBrowser. Il est écrit en bash, et sa seule dépendance est dialog.

View file

@ -1,65 +0,0 @@
from urllib.parse import urlparse
# Function to generate a bookmark line in HTML format
def generate_bookmark(title, url):
return f'<DT><A HREF="{url}" ADD_DATE="">{title}</A>\n'
# Dictionary to store folders and their bookmarks
folders = {}
# Path to your source file
file_path = 'bookmarks.txt'
# Read the file and process each line
with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
default_folder = "Others" # Default folder for lines without a folder prefix
urls_seen = set()
for line in lines:
line = line.strip() # Remove leading/trailing whitespace
parts = line.rsplit(" ", 1) # Split URL from the rest of the line
if len(parts) == 2:
url = parts[-1]
if url not in urls_seen:
urls_seen.add(url)
title = parts[0]
if " - " in title:
folder_name = title.split(" - ", 1)[0] # Extract folder name
title = title.split(" - ", 1)[1] # Extract title without folder prefix
else:
folder_name = default_folder
if folder_name not in folders:
folders[folder_name] = []
folders[folder_name].append(generate_bookmark(title, url))
else:
print(f"Ignored duplicate: {line}")
else:
# Handle malformed or improperly formatted lines
print(f"Ignored line: {line}")
# Generate HTML content
html_content = """<!DOCTYPE NETSCAPE-Bookmark-file-1>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Imported Bookmarks</TITLE>
<H1>Imported Bookmarks</H1>
<DL><p>\n"""
# Add folders and their bookmarks to the HTML content
for folder, bookmarks in folders.items():
html_content += f'<DT><H3>{folder}</H3>\n<DL><p>\n'
for bookmark in bookmarks:
html_content += bookmark
html_content += "</DL><p>\n"
html_content += "</DL><p>\n"
# Write content to an HTML file
output_file = "bookmarks.html"
with open(output_file, "w", encoding="utf-8") as file:
file.write(html_content)
print(f"Conversion completed. HTML file generated successfully: {output_file}")

View file

@ -1,65 +0,0 @@
from urllib.parse import urlparse
# Fonction pour générer une ligne de marque-page au format HTML
def generate_bookmark(title, url):
return f'<DT><A HREF="{url}" ADD_DATE="">{title}</A>\n'
# Dictionnaire pour stocker les dossiers et leurs marque-pages
folders = {}
# Chemin vers votre fichier source
file_path = '/home/t0mux/Sync/Conf/qb/quickmarks'
# Lecture du fichier et traitement des lignes
with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
default_folder = "Autres" # Dossier par défaut pour les lignes sans préfixe de dossier
urls_seen = set()
for line in lines:
line = line.strip() # Supprime les espaces inutiles autour de la ligne
parts = line.rsplit(" ", 1) # Sépare l'URL du reste de la ligne
if len(parts) == 2:
url = parts[-1]
if url not in urls_seen:
urls_seen.add(url)
title = parts[0]
if " - " in title:
folder_name = title.split(" - ", 1)[0] # Extrait le nom du dossier
title = title.split(" - ", 1)[1] # Extrait le titre sans le dossier
else:
folder_name = default_folder
if folder_name not in folders:
folders[folder_name] = []
folders[folder_name].append(generate_bookmark(title, url))
else:
print(f"Doublon ignoré : {line}")
else:
# Gérer les lignes mal formées ou non conformes au format attendu
print(f"Ligne ignorée : {line}")
# Génère le contenu HTML
html_content = """<!DOCTYPE NETSCAPE-Bookmark-file-1>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Marque-pages importés</TITLE>
<H1>Marque-pages importés</H1>
<DL><p>\n"""
# Ajoute les dossiers et leurs marque-pages au contenu HTML
for folder, bookmarks in folders.items():
html_content += f'<DT><H3>{folder}</H3>\n<DL><p>\n'
for bookmark in bookmarks:
html_content += bookmark
html_content += "</DL><p>\n"
html_content += "</DL><p>\n"
# Écrit le contenu dans un fichier HTML
output_file = "marque_pages.html"
with open(output_file, "w", encoding="utf-8") as file:
file.write(html_content)
print(f"Conversion terminée. Fichier HTML généré avec succès : {output_file}")