Photo: HBO

In its second season, David Simon and George Pelecanos’s The Deuce jumps five years ahead to 1977. To paraphrase one of Simon’s favorite novelists, it’s the worst and best of times. It’s an era of glitter balls, platform shoes, cocaine, and the open sale of sex. New York City is financially depressed and crime-ridden. Newly elected Mayor Ed Koch is pledging to clean up midtown and make it safe for tourists, a mission established in Sunday’s season premiere, “Our Raison d’Etre,” when detective Chris Alston (Lawrence Gilliard Jr.) investigates the stabbing death of a Kmart assistant manager who drove in from Harrisburg to see Beatlemania. But Times Square, and the nightlife and leisure industries generally, are thriving.

Discos and punk clubs are packed. Eight years after the Stonewall uprising, gay and lesbian citizens are opening more spots that are designed to let them be themselves. Brothels are popping up all over midtown, shifting the flow of money from a rainbow coalition of streetwalkers and their African-American pimps to mostly middle-class, white ethnic owners and managers. Lush theatrical softcores like the Emmanuelle films are being shot on 35 mm. with gorgeous lighting and exotic locations. Newspapers are running ads for Rocky and The Party at Kitty and Stud’s side-by-side. PG-rated Hollywood films include topless scenes. Just seven years earlier, Midnight Cowboy, a Times Square–set drama about a gigolo and his con-man friend, became the first (and so far only) X-rated film to win an Oscar as Best Picture. We know from history books that this is the city’s Weimar era of sexual freedom, decadent to the point of naive innocence, and that the AIDS epidemic and a Giuliani-endorsed corporate takeover will finally end it. But the major characters of The Deuce have no way of knowing this. They’re more comfortably settled than in season one, which tends to happen when you aren’t looking over your shoulder every second. Their minds are abuzz with schemes to evolve. The show evolves with them.

Co-written by Pelecanos and Simon, season two’s opener starts with a lengthy tracking shot that feels like an answer to the four-minute curtain-raiser of Boogie Nights (set the same year), following streetwalker turned porn star turned filmmaker Eileen “Candy” Merrell (Maggie Gyllenhaal) as she glides through Club 366, a new, Mafia-backed disco operated by Vincent Martino (James Franco). Director Alex Hall jumps from character to character, reacquainting us with the show’s major players, and future scenes catch us up with everyone who wasn’t in the club that night.

Vincent’s girlfriend Abby (Margarita Levieva) has turned his first bar, the Hi-Hat, into a hip joint that showcases cutting-edge New Wave and punk acts, and she’s starting to resent the brutality and degradation of sex work that’s constantly being placed in front of her. (She even gravitates towards activists who treat streetwalkers and call girls as an oppressed class, and who try to improve their health and help them defend themselves against the worst exploitation.) Detective Alston is being pressured to join a Times Square task force that thinks it can clean up the neighborhood by raiding brothels; because the character knows so much about past, failed morals crusades, and because Gilliard uses his seen-it-all smile so cagily, it’s hard to tell if the cop is cynical about the very idea of sanitizing the Deuce, or skeptical that it can be done by a police force that’s still blatantly corrupt, even post-Serpico.

In the time since we last saw her, Lori (Emily Meade) is enjoying some limited success as a porn performer, including a nomination as Best Supporting Actress from an adult-film awards group that sends her to Los Angeles and further strains her already fraught relationship with her pimp C.C. (Gary Carr), who’s worried that the old-fashioned street-pimp business is being marginalized by mob-financed brothels and adult filmmaking. Darlene (Dominique Fishback) is still way too intellectually restless for most of the rooms she’s in — her reading list this season includes Toni Morrison’s Song of Solomon, a novel about how patriarchal systems that oppress women and emotionally damage men are handed down through the generations. Her pimp Larry (Gbenga Akinnagbe) keeps looking around film sets while he’s waiting on Darlene, wondering if there could be a place for him here, too. (As Lori observes, there’s a new generation of actresses who go straight into porn from high school, and “never whored, never will.”)

Former Hi-Hat bartender Paul Hendrickson (Chris Coy) has done well for himself with a mob-backed gay bar, but wants to open a more upscale cabaret joint without taking Italian money. (“More conversation, less cock,” a real-estate broker summarizes.) Vincent’s brother Frankie, also played by Franco, is still trying to see what he can get away with. He’s even started treating the peep show’s back-office safe as a piggy bank, filching bags of quarters and forcing his brother to decide whether to call him on it. (If Franco were playing a sweet and decent character, the recent accusations that he creeped on film students would make his scenes unwatchable, but playing two lowdown characters, he just seems typecast.)

Candy, meanwhile, is trying to ease away from making formulaic grinders. She argues with her mentor Harvey Wasserman (David Krumholtz, whose weight loss is written into the show’s dialogue) about her editing of a three-way sex scene in a recent film, which intercuts the screwing with inserts of a ceiling fan, a campfire, a fist squeezing juice from an orange half, and a lion chasing a zebra. “So now we’re making art?” Harvey asks sarcastically. Maybe “erotica” is a better word. Harvey doesn’t entirely discourage her — he’s an arts-and-humanities name dropper who hangs art-film posters on his office walls — but he does advise Candy to make the scene more about insertions than inserts. He also cautions that her not-so-secret agenda to put us inside the female character’s head is incompatible with male viewers’ desire to be, well, just inside. Candy wants to make porn with imagination, or at least a sense of play along the lines of 1976’s Alice in Wonderland: An X-Rated Musical Fantasy.

This new batch of episodes feels lighter — or at least has a lighter touch — than most of season one, though it doesn’t stay in that mode forever. A lot of the writing has the moment-to-moment exactness of a comedy of manners, or a casual conversation between veterans of the same business. (The Wire and Treme also excelled at those sorts of interactions.) The bulk of The Deuce’s storytelling explores work, and work’s effect on everything we’ve labeled as not-work, and how relationships are also a form of work, or at least require the same diligent approach as work if they’re going to succeed long-term. The most indelible moments treat transactional details of sex work and adult filmmaking with the same blend of attention and irreverence that The Deuce brings to scenes of mobsters and mob-affiliated entrepreneurs (like Vincent, Frankie, and Paul) dealing with construction crews, government bureaucrats, investors, employees, and customers.

Characters psych themselves up to ask a higher-up for more money or respect, or question an expert with valuable knowledge, exemplified in a scene where Candy picks the brain of a more successful female director. Whether they get what they wanted, something less, something else, or nothing, they always learn something — unless they’re stupid or self-destructive, and The Deuce has plenty of those kinds of characters, too. There’s a sub-theme about veterans whose pride makes them unable to accept ideas from anyone below them on the ladder. You see this play out in the Times Square task-force storyline, as well as in the subplots that unfold on film sets, but particularly in any scene involving Candy, whose greatest strength is her ability to realize what she doesn’t know, then seek out somebody who can fill gaps in her knowledge without getting hung up on matters of ego or turf.

The impact of sex and race on wages is never far from the show’s mind. Many scenes make us aware of an American social pecking-order that political activists decry to this day: straight white men on top, straight white women a rung under them, and everyone else below in a diminishing order that changes a wee bit depending on what’s happening in the culture at that moment. Things are different in sex work, as The Deuce is apt to point out — although, to its credit, the writers always make sure to emphasize that none of the hierarchical distinctions are unyielding — and they can change quickly and drastically if you relocate the action from, say, a street corner to a film set, or from a gay neighborhood to a straight one, or from a police precinct house to an Italian restaurant where Gambino family capo and Times Square power-player Rudy Pipilo (Michael Rispoli) is dining with his gang. Lori and and Darlene are indentured servants as far as their black male pimps are concerned, but those same pimps become nearly powerless when they’re shunted to the sidewalks so their girls can participate in a baby shower, or made to hurry up and wait while an all-white film crew finishes shooting a cheapjack Hawaiian tourist fantasy.

With a few conspicuous exceptions, the series also continues the Simon/Pelecanos tradition of giving viewers lots of subtext to chew on, integrated into what sound like ordinary discussions. The many scenes where Harvey and Candy argue about her creative ambitions are the best example. They’re about what they’re about — a woman trying to carve out a personal, somewhat feminist place for herself in a sexist industry — but they’re also about the specific conundrum of making a drama for HBO, which built its fortune catering to what reactionaries would call “prurient interests,” while supplying enough in the way of art that you couldn’t plausibly write off all of their programming as spank fodder. (They finally shut down their soft-core operations just this summer.) Related to all this is a running commentary about high and low culture as defined in the 1970s, the last American decade when reading wasn’t considered an “elitist” activity. It’s expressed not just through the content of the characters’ conversations, but the rhythm of their lines. The Deuce weaves in earnest references to poetry and novels, plays and musicals, Italian and French cinema, Sigmund Freud and Bruno Bettelheim, then deflates them with a joke — the dialogue writer’s equivalent of Harvey warning Candy not to cut away from the sex too much. “There are more things in heaven and Earth, Horatio, than are dreamt of in your philosophy,” Paul tells Frankie, then adds, “That’s Shakespeare.” “Shakespeare was gay?” asks Vincent.