\documentclass{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{papercdcase}
\usepackage[margin=0pt]{geometry}
\usepackage{mdwlist}

\pagestyle{empty}
\setlength{\parindent}{0pt}

\def\maxilatchtext#1{\setcdlatchmatter{\textsf{\textbf{\Large #1}}}}
\def\maxispinetext#1{\setcdspinematter{\textsf{\textbf{\large #1}}}}
\def\maxibacktext#1#2{\setcdbackmatter{\textsf{\textbf{\Large #1}\small #2}}}

\def\latchtext#1{\setcdlatchmatter{\textsf{\textbf{\LARGE #1}}}}
\def\spinetext#1{\setcdspinematter{\textsf{\textbf{\Large #1}}}}
\def\backtext#1#2{\setcdbackmatter{\textsf{\textbf{\LARGE #1}#2}}}

\def\empty{}
\def\yes{yes}

\toksdef\ta=0%
\toksdef\tb=2%
\long\def\rightappenditem#1\to#2{\ta={#1}\tb=\expandafter{#2}\edef#2{\the\tb\the\ta}}
\long\def\erightappenditem#1\to#2{\tb=\expandafter{#2}\xdef#2{\the\tb\noexpand{#1}}}

\def\msg{****************************************************************************}

\begin{document}

\typeout{}
\typeout{\msg}
\typeout{* Please enter "yes" if you'd like to create a case for a maxi (80mm) CD,}
\typeout{* just hit enter if not!}
\typein[\cdmaxi]{\msg}

\typeout{}
\typeout{\msg}
\typeout{* Please enter the artist, if any!}
\typein[\cdartist]{\msg}

\typeout{}
\typeout{\msg}
\typeout{* Please enter the CD title, if any!}
\typein[\cdtitle]{\msg}

\newif\iftrackgiven
\def\tracks{}
\typeout{}
\typeout{\msg}
\typeout{* Please enter the tracks (to finish, just enter a blank line)!}
\loop
\def\nexttrack{}
\typein[\nexttrack]{\msg}
\ifx\nexttrack\empty%
\trackgivenfalse%
\else%
\rightappenditem\item\to\tracks%
\erightappenditem\nexttrack\to\tracks%
\trackgiventrue%
\fi%
\iftrackgiven%
\def\msg{}%
\repeat

\ifx\cdmaxi\yes%
\ifx\cdtitle\empty%
\maxilatchtext{\cdartist}%
\maxispinetexi{\cdartist}%
\ifx\tracks\empty%
\maxibacktext{\cdartist}{}%
\else%
\maxibacktext{\cdartist}{\begin{enumerate*}\tracks\end{enumerate*}}%
\fi\else\ifx\cdartist\empty%
\maxilatchtext{\cdtitle}%
\maxispinetext{\cdtitle}%
\ifx\tracks\empty%
\maxibacktext{\cdtitle}{}%
\else%
\maxibacktexi{\cdtitle}{\begin{enumerate*}\tracks\end{enumerate*}}%
\fi\else%
\maxilatchtext{\cdartist\\[0.25\baselineskip]\cdtitle}%
\maxispinetext{\cdartist/\cdtitle}%
\ifx\tracks\empty%
\maxibacktext{\cdartist\\[0.25\baselineskip]\cdtitle}{}%
\else%
\maxibacktext{\cdartist\\[0.25\baselineskip]\cdtitle}{\begin{enumerate*}\tracks\end{enumerate*}}%
\fi\fi\fi
\centering\papercdcase[80]
\else
\ifx\cdtitle\empty%
\latchtext{\cdartist}%
\spinetexi{\cdartist}%
\ifx\tracks\empty%
\backtext{\cdartist}{}%
\else%
\backtext{\cdartist}{\begin{enumerate*}\tracks\end{enumerate*}}%
\fi\else\ifx\cdartist\empty%
\latchtext{\cdtitle}%
\spinetext{\cdtitle}%
\ifx\tracks\empty%
\backtext{\cdtitle}{}%
\else%
\backtexi{\cdtitle}{\begin{enumerate*}\tracks\end{enumerate*}}%
\fi\else%
\latchtext{\cdartist\\[0.4\baselineskip]\cdtitle}%
\spinetext{\cdartist/\cdtitle}%
\ifx\tracks\empty%
\backtext{\cdartist\\[0.4\baselineskip]\cdtitle}{}%
\else%
\backtext{\cdartist\\[0.4\baselineskip]\cdtitle}{\begin{enumerate*}\tracks\end{enumerate*}}%
\fi\fi\fi
\centering\papercdcase
\fi

\end{document}
