|
| 1 | +# Using pmdb |
| 2 | + |
| 3 | +After the [installation](installation.md) is done, you can start using `pmdb`. |
| 4 | +For that you need private messages from a vBulletin forum, download in XML |
| 5 | +format. vBulletin offers options to download all private messages as XML, CSV or |
| 6 | +text, but `pmdb` can only use the XML format, not text or CSV. Use XML only. |
| 7 | +Usually all private messages can be downloaded via a link like |
| 8 | +`https://www.example.com/forum/private.php?do=downloadpm&dowhat=xml`, adjust |
| 9 | +accordingly for your case. |
| 10 | + |
| 11 | +## Importing messages from XML |
| 12 | + |
| 13 | +Assuming the XML file was downloaded as `privatemessages-Name-31.12.2024.xml` to |
| 14 | +the current directory, you can let `pmdb` process the file by typing |
| 15 | + |
| 16 | +```sh |
| 17 | +pmdb --xml privatemessages-Name-31.12.2024.xml |
| 18 | +``` |
| 19 | + |
| 20 | +Doing so will display something like |
| 21 | + |
| 22 | +``` |
| 23 | +XML file "privatemessages-Name-31.12.2024.xml" was queued for loading. |
| 24 | +Import of private messages from privatemessages-Name-31.12.2024.xml was successful. |
| 25 | + 321 PMs read, new PMs: 321 |
| 26 | +PMs in the database: 321 |
| 27 | +Messages saved successfully. |
| 28 | +Folder map saved successfully. |
| 29 | +``` |
| 30 | + |
| 31 | +`pmdb` tells you that it imported the private messages ("PMs") successfully, and |
| 32 | +how many messages were read - in that case 312 messages. It also saves the |
| 33 | +imported messages to its [data directory](directories.md) for later use. |
| 34 | + |
| 35 | +You can add more messages at a later point by adding more XML files. Or you can |
| 36 | +also let `pmdb` process several XML files at once. Just repeat the `--xml` |
| 37 | +paramater and add another file name. For example, |
| 38 | + |
| 39 | +```sh |
| 40 | +pmdb --xml privatemessages-Name-31.12.2024.xml --xml other/directory/privatemessages-Name-28.02.2025.xml |
| 41 | +``` |
| 42 | + |
| 43 | +will process both `privatemessages-Name-31.12.2024.xml` and |
| 44 | +`other/directory/privatemessages-Name-28.02.2025.xml` and import messages from |
| 45 | +those files. In that case the program's output could look like |
| 46 | + |
| 47 | +``` |
| 48 | +XML file "privatemessages-Name-31.12.2024.xml" was queued for loading. |
| 49 | +XML file "other/directory/privatemessages-Name-28.02.2025.xml" was queued for loading. |
| 50 | +Import of private messages from privatemessages-Name-31.12.2024.xml was successful. |
| 51 | + 321 PMs read, new PMs: 321 |
| 52 | +Import of private messages from other/directory/privatemessages-Name-28.02.2025.xml was successful. |
| 53 | + 345 PMs read, new PMs: 24 |
| 54 | +PMs in the database: 345 |
| 55 | +Messages saved successfully. |
| 56 | +Folder map saved successfully. |
| 57 | +``` |
| 58 | + |
| 59 | +If two files contain the same messages, `pmdb` will recognize this and not add |
| 60 | +the same message twice. It basically does automatic deduplication on import, so |
| 61 | +you don't have to worry about overlapping messages in the XML files. |
| 62 | + |
| 63 | +## Generate HTML files |
| 64 | + |
| 65 | +OK, so now that we have imported those messages, how can we actually view them? |
| 66 | +That's where HTML generation steps in. `pmdb` will generate HTML files for each |
| 67 | +message so that you can then view them in a browser. Just type |
| 68 | + |
| 69 | +```sh |
| 70 | +pmdb --html |
| 71 | +``` |
| 72 | + |
| 73 | +and `pmdb` does the rest. It will print something like |
| 74 | + |
| 75 | +``` |
| 76 | +Loading messages from /home/name/.pmdb/messages/ ... |
| 77 | +All messages from /home/name/.pmdb/messages/ loaded. Read: 345; new: 345 |
| 78 | +Loaded folder map from /home/name/.pmdb/messages/, too. |
| 79 | +PMs in the database: 345 |
| 80 | +Messages saved successfully. |
| 81 | +Folder map saved successfully. |
| 82 | +Loading pmdb.conf was successful. |
| 83 | +Creating HTML files for message texts. This may take a while... |
| 84 | +All HTML files were created successfully! |
| 85 | +Opening /home/name/.pmdb/html/folder_94835ea2fcf775cd77cb9c9cee01b5cbd9bc515467aab1215f48a5ade9ca5274.html in browser ... |
| 86 | +``` |
| 87 | + |
| 88 | +It will then open the generated file in a browser, for example Firefox or |
| 89 | +Chromium. There you can browse through the messages as if they were in the |
| 90 | +forum. |
| 91 | + |
| 92 | +## Doing it all in one go |
| 93 | + |
| 94 | +Of course, you can import message data in one step and then generate the HTML |
| 95 | +files to view in a second step, but `pmdb` also can do that in one go. Staying |
| 96 | +with the file names from above, you could just type |
| 97 | + |
| 98 | +```sh |
| 99 | +pmdb --xml privatemessages-Name-31.12.2024.xml --xml other/directory/privatemessages-Name-28.02.2025.xml --html |
| 100 | +``` |
| 101 | + |
| 102 | +to import both XML files and generate the corresponding HTML files in one step. |
| 103 | +In that case, assuming no messages have been imported so far, the output of |
| 104 | +`pmdb` could be: |
| 105 | + |
| 106 | +``` |
| 107 | +XML file "privatemessages-Name-31.12.2024.xml" was queued for loading. |
| 108 | +XML file "other/directory/privatemessages-Name-28.02.2025.xml" was queued for loading. |
| 109 | +Import of private messages from privatemessages-Name-31.12.2024.xml was successful. |
| 110 | + 321 PMs read, new PMs: 321 |
| 111 | +Import of private messages from other/directory/privatemessages-Name-28.02.2025.xml was successful. |
| 112 | + 345 PMs read, new PMs: 24 |
| 113 | +PMs in the database: 345 |
| 114 | +Messages saved successfully. |
| 115 | +Folder map saved successfully. |
| 116 | +Loading pmdb.conf was successful. |
| 117 | +Creating HTML files for message texts. This may take a while... |
| 118 | +All HTML files were created successfully! |
| 119 | +Opening /home/name/.pmdb/html/folder_94835ea2fcf775cd77cb9c9cee01b5cbd9bc515467aab1215f48a5ade9ca5274.html in browser ... |
| 120 | +``` |
| 121 | + |
| 122 | +And `pmdb` will then open the generated HTML file in the browser. |
| 123 | + |
| 124 | +In general, `pmdb` will let you combine paramaters and tasks freely most of the |
| 125 | +time. (There are some exceptions like the `--help` or `--version` parameters |
| 126 | +which will just print the information and then exit.) |
0 commit comments