Inquisitor

Vichan-mlpach support for better >>links

Oct 12th, 2016
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 2.20 KB | None | 0 0
  1. @Echo Off
  2. CD /D "%~dp0"
  3. Set Path=%!!%Path%
  4.  
  5. :: Settings
  6. Set Board=r34
  7. Set In=posts_%Board%.sql
  8. Set Out=edited_%In%
  9.  
  10.  
  11. Call :CreateDatabase >"%Out%"
  12. Call :DatabaseStructure >>"%Out%"
  13.  
  14. For /F "eol= delims=" %%? In ('FindStr /BC:"(" "%In%"') Do (
  15.     Set $Post=%%?
  16.     Set "$Replace="
  17.     For /F "eol= delims=" %%L In ('Set $Post^|grep -Eo "onclick=.highlight[^<>]*>[^<>]+"') Do (
  18.         For /F "tokens=2 eol= delims='" %%N In ("%%L") Do (
  19.             For /F "tokens=1,* delims==" %%A In ('Set $Post^|sed -r "s|(onclick=.highlightReply.''%%N''.;.)|class=''post-replyto'' data-replyto=''%%N'' \1|g"') Do (
  20.                 Echo %%B
  21.                 Set $Replace=true
  22.             )
  23.         )
  24.     )
  25.     Set $Replace >nul 2>nul||Echo %%?
  26. )>>"%Out%"
  27. Exit
  28.  
  29. :CreateDatabase
  30.     Echo. CREATE TABLE IF NOT EXISTS `posts_%Board%` (
  31.     Echo.  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  32.     Echo.  `thread` int(11) DEFAULT NULL,
  33.     Echo.  `subject` varchar(100) DEFAULT NULL,
  34.     Echo.  `email` varchar(30) DEFAULT NULL,
  35.     Echo.  `name` varchar(35) DEFAULT NULL,
  36.     Echo.  `trip` varchar(15) DEFAULT NULL,
  37.     Echo.  `capcode` varchar(50) DEFAULT NULL,
  38.     Echo.  `body` text NOT NULL,
  39.     Echo.  `body_nomarkup` text,
  40.     Echo.  `time` int(11) NOT NULL,
  41.     Echo.  `bump` int(11) DEFAULT NULL,
  42.     Echo.  `files` text,
  43.     Echo.  `num_files` int(11) DEFAULT '0',
  44.     Echo.  `filehash` text CHARACTER SET ascii,
  45.     Echo.  `password` varchar(20) DEFAULT NULL,
  46.     Echo.  `ip` varchar(39) CHARACTER SET ascii NOT NULL,
  47.     Echo.  `sticky` int(1) NOT NULL,
  48.     Echo.  `locked` int(1) NOT NULL,
  49.     Echo.  `sage` int(1) NOT NULL,
  50.     Echo.  `embed` text,
  51.     Echo.  `slug` varchar(256) DEFAULT NULL,
  52.     Echo.  `cutiemark` char(30) DEFAULT NULL,
  53.     Echo.  UNIQUE KEY `id` (`id`),
  54.     Echo.  KEY `thread_id` (`thread`,`id`),
  55.     Echo.  KEY `filehash` (`filehash`(40)),
  56.     Echo.  KEY `time` (`time`),
  57.     Echo.  KEY `ip` (`ip`),
  58.     Echo.  KEY `list_threads` (`thread`,`sticky`,`bump`)
  59.     Echo.) ENGINE=MyISAM  DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=51 ;
  60. Exit /B
  61.  
  62. :DatabaseStructure
  63.     Echo.
  64.     Echo. INSERT INTO `posts_%Board%` (`id`, `thread`, `subject`, `email`, `name`, `trip`, `capcode`, `body`, `body_nomarkup`, `time`, `bump`, `files`, `num_files`, `filehash`, `password`, `ip`, `sticky`, `locked`, `sage`, `embed`, `slug`, `cutiemark`) VALUES
  65. Exit /B
Advertisement
Add Comment
Please, Sign In to add comment